Not everyone uses a mouse to explore a website. Good HTML must also make sense through a keyboard or screen reader.
What You Need to Know
A tiny target is hard to activate on touchscreens. A linked label can make a checkbox or radio button easier to tap. Leave enough spacing so people do not trigger the wrong control.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<nav aria-label="Quick links">
<a href="/home">Home</a>
<a href="/lessons">Lessons</a>
</nav>
<p>CSS can enlarge the link hit areas without changing their names.</p>
Let’s Read the Code
- <nav>: Navigation elements identify groups of important links.
- aria-label: Aria-label supplies an accessible name when a visible one is not available.
- href: Href is the URL to a related resource or destination.
Read the named elements and attributes together. They explain how the browser connects this feature to the rest of the page.
What Happens in the Browser?
Try this with Tab and Shift+Tab. If you can, inspect the accessibility tree too; appearance alone does not tell the whole story.
What does assistive technology receive? The example includes aria-label. These relationships can explain names, states, or descriptions when used correctly. They do not automatically move focus, listen for clicks, or create keyboard handling.
Your Turn
Use Tab and Shift+Tab to visit the controls, then read their labels aloud. Is the purpose of each one clear?
Common Beginner Mistakes
- Judging the page only by how it looks, without checking its meaning and keyboard behavior.
- Check the same result using both the browser and a keyboard, not only by looking at the screen.
Key Takeaways
- A tiny target is hard to activate on touchscreens.
- <nav>: Navigation elements identify groups of important links.
- Test the behavior you expect rather than trusting how the snippet looks in your editor.