HTML & CSS · Middle · Question 40 of 75
When is aria-label justified?
- 1Always, on every element: it helps search engines understand the page
- ✓Correct answer: When an interactive element has no visible text, like an icon button
- 3Instead of
alton images - it's the more modern way
Explanation
aria-label sets an element's accessible name when there's no visible label: <button aria-label="Close">✕</button>. The first rule of ARIA is not to use it when a native option exists: alt for images, <label> for fields. aria-label doesn't affect SEO, and an unnecessary one can override clear visible text.