The <nav> element
The <nav> tag marks a section of major navigation links — a main menu, table of contents, or breadcrumb trail. Not every group of links needs a <nav>; reserve it for primary navigation blocks so assistive technology can let users jump straight to them.
Last updated: October 3, 2026
Quick facts
| Category | Flow content, sectioning content, palpable content |
| Content model | Flow content |
| Tag omission | Neither the start nor end tag can be omitted |
| Permitted parents | Any element that accepts flow content |
| DOM interface | HTMLElement |
Syntax
Live example
Edit the code below and watch the preview update instantly.
Attributes
| Attribute | Description |
|---|---|
| — | <nav> has no attributes of its own — only the global attributes shared by every HTML element. |
Common examples
The main site menu
The classic pattern: a <nav> landmark around an unordered list of links, laid out in a row with flexbox.
Breadcrumbs
A breadcrumb trail is navigation too. Label it so screen reader users know which navigation they’re in.
A table of contents
Long articles can include a <nav> of links to their own sections.
A “Skip to content” link
Put this link first in the page so keyboard users can jump past the navigation. It stays hidden until it receives keyboard focus.
<nav> vs <ul>
They work together rather than compete. The <nav> element marks a region of the page as navigation — a landmark screen reader users can jump straight to. The <ul> inside it organises the links as a list, so assistive technology can announce how many links there are.
So a menu is usually <nav> on the outside and <ul> with <li> items on the inside. A short row of links can skip the list, but the <nav> wrapper is what tells everyone “this is a menu”.
| <nav> | <ul> | |
|---|---|---|
| Purpose | Marks a navigation region | Groups items as a list |
| Landmark for screen readers | Yes | No |
| Typical use | Wraps the menu | Holds the menu links |
Common mistakes to avoid
- Wrapping every group of links in
<nav>. Keep it for major navigation blocks; a few links in a paragraph or a footer’s legal links don’t need it. - Several navs with no labels. If a page has more than one
<nav>, give each anaria-label(“Main”, “Breadcrumb”, “Footer”). - A mobile menu toggle made from a div. The ☰ button must be a real <button> with
aria-expandedso keyboard and screen reader users can open it. - Hiding the menu from keyboard users. Menus that only open on mouse hover can’t be used with the Tab key.
Accessibility & SEO tips
- Mark the current page’s link with
aria-current="page"and style it, so everyone can see where they are. - Add a “Skip to content” link at the very top of the page so keyboard users can jump past the navigation.
- Clear, consistent navigation links help search engines discover and understand your important pages.
Browser support
Supported in all modern browsers, including Chrome, Edge, Firefox, Safari and their mobile versions. It was introduced with HTML5, and only very old browsers such as Internet Explorer 8 needed workarounds.
Tutorials: How to add a link, How to make a dropdown menu, How to make a footer, How to make a navigation bar