<nav>
Example
<nav>
<a class="active" href="/">Home</a>
<a href="/docs">Docs</a>
</nav><nav aria-label="Main">
<a aria-current="page" href="/">Home</a>
<a href="/docs">Docs</a>
</nav>The label names the landmark, and aria-current tells screen readers which page is active.
Common mistakes
- Wrapping every group of links, like footer legal links, in
<nav>. - Having two unlabeled
<nav>elements that screen readers cannot tell apart.
Key points
- Each
<nav>on a page has a distinctaria-label, like 'Main' or 'Breadcrumb'. - The link to the current page has
aria-current="page". - Navigation items are real
<a href>links, often inside a<ul>.
Interview questions
Should links inside <nav> be in a list?
<nav> be in a list?A <ul> is common and lets screen readers announce the number of links, but it is not required.
Can I have more than one <nav> on a page?
<nav> on a page?Yes. Give each one a unique aria-label so users can tell them apart.