HTML Reference ยท Sections
The <nav> element
Reference for the HTML <nav> element: which link groups deserve it, labeling several navs, the navigation landmark, aria-current, examples and technical details.
The <nav> element marks a section of major navigation links: links to other pages of the site or to parts of the current page. Main menus, tables of contents, breadcrumbs and pagination are typical examples.
<nav aria-label="Main"> <ul> <li><a href="/">Home</a></li> <li><a href="/menu">Menu</a></li> <li><a href="/book">Book a table</a></li> </ul> </nav>
Try it
aria-current="page" tells assistive technology which link points to the current page, and doubles as a handy CSS hook.
Attributes
This element has no attributes of its own. It accepts the global attributes; aria-label or aria-labelledby should name each nav when a page has more than one.
Usage notes
- Major blocks only. Not every group of links is a
<nav>. A list of legal links in the footer or links inside a paragraph usually don't need it. Reserve it for the navigation people would want to jump to. - Label multiple navs. Screen readers announce each
<nav>as anavigationlandmark. Names like "Main", "Breadcrumb" or "Table of contents" let users tell them apart. Don't include the word "navigation" in the label; it is announced already. - Use a list inside. A
<ul>(or an<ol>when the order matters, as in breadcrumbs) tells users how many links there are. - Placement. A main menu is often inside the page
<header>; a table of contents may sit in an<aside>or at the top of the<main>content. - Mobile menus. A menu toggle button should control the nav with
aria-expanded. The Building Navigation Menus lesson builds one step by step.
Technical summary
| Content categories | Flow content, sectioning content, palpable content |
| Permitted content | Flow content |
| Tag omission | None; both the start and end tags are required |
| Permitted parents | Any element that accepts flow content |
| Implicit ARIA role | navigation |
| DOM interface | HTMLElement |
| Default display | block |
Browser support
Supported in every browser.
Related
<a>โ the links themselves<ul>โ a list to hold the links<header>โ where the main menu usually sits<search>โ a search or filter form- Lessons: Building Navigation Menus, Semantic Elements, Links in Depth