HTML <nav> Tag

The <nav> element marks a section of major navigation links — site menus, tables of contents, indexes, or breadcrumbs — within the current document or to other pages.

It is sectioning content with an implicit navigation landmark. Put links inside <ul> / <ol> when a list fits; wrap each destination with <a>.

Baseline · Widely available.

Not deprecated. Stable across browsers since about July 2015 (HTML5 landmark).

Do not overuse.

Not every link group needs <nav>. Reserve it for major navigation blocks so landmarks stay useful for screen reader users.

ARIA note.

Skip redundant role="navigation" — <nav> already exposes that role. Prefer aria-label when a page has more than one <nav>.

HTML Syntax

syntax.html
<nav> …links…</nav>

Both start and end tags are required. Content is flow content (often a list of links).

Attributes

<nav> has no element-specific attributes. Use global attributes; these are the ones you will reach for most often:

AttributeDescriptionTry it
(none specific)No tag-only attributes — meaning comes from the element itselfTry it
aria-labelAccessible name for the landmark (e.g. Main, Breadcrumb) when several <nav>s existTry it
aria-labelledbyPoints to a visible heading id that names this navigationSee multiple navs
class / idHooks for CSS and scriptingTry it

Global Attributes

The <nav> tag also supports the Global Attributes in HTML.

Live Preview

Switch common <nav> patterns. Links use href="#" for the demo only.

Preview

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Main Site Menu

A primary navigation list with an accessible landmark name.

HTML
<nav aria-label="Main">
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/html">HTML</a></li>
    <li><a href="/css">CSS</a></li>
  </ul>
</nav>
Try It Yourself

How It Works

  1. Wrap the block in <nav> so it becomes a navigation landmark.
  2. Add aria-label when helpful (especially if other navs exist later).
  3. List destinations with <ul> / <li>.
  4. Link each item with <a href="…">.

Example 2 — Breadcrumb Trail

Use an ordered list for hierarchy; the last item is often the current page (not a link).

HTML
<nav aria-label="Breadcrumb">
  <ol>
    <li><a href="/">Home</a></li>
    <li><a href="/html">HTML</a></li>
    <li><a href="/html/tags">Tags</a></li>
    <li>nav</li>
  </ol>
</nav>
Try It Yourself

How It Works

  1. Label the landmark (e.g. aria-label="Breadcrumb").
  2. Use <ol> because order matters in a path.
  3. Link ancestors; leave the current page as plain text in the last <li>.
  4. Style separators with CSS if needed — keep markup semantic.

Example 3 — Two Labeled <nav>s

Site chrome and in-page sections are easier to tell apart when each landmark has a name.

HTML
<nav aria-label="Main">
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/html">HTML</a></li>
  </ul>
</nav>

<nav aria-label="On this page">
  <ul>
    <li><a href="#definition">Definition</a></li>
    <li><a href="#examples">Examples</a></li>
  </ul>
</nav>
Try It Yourself

How It Works

  1. Create separate <nav> blocks for different purposes.
  2. Give each a unique aria-label (or aria-labelledby + heading).
  3. Keep lists focused so each landmark stays short and scannable.
  4. Avoid wrapping the whole page in one giant <nav>.

Edge Cases & Pitfalls

overuse

Wrapping every link cluster

Too many navigation landmarks dilute the landmark list. Use <nav> for major blocks only.

a11y

Unnamed multiple navs

Two unlabeled <nav>s both announce as “navigation.” Add aria-label or a heading + aria-labelledby.

role

Redundant role="navigation"

<nav> already maps to that role. Extra roles on nav are not allowed in the HTML mapping.

semantics

div with the same look

A styled <div> is not a landmark. Prefer real <nav> for major menus.

header

Nav inside header

Valid and common. <header> can contain site branding plus a primary <nav>.

menu

<menu> is not a replacement

<menu> is for toolbar-style lists of commands. Site navigation still belongs in <nav>.

Browser Support

The <nav> element is core HTML sectioning content in every modern browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<nav>

Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera all support it as a navigation landmark.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer 9+
Supported
<nav> Widely supported

Bottom line: Safe to use everywhere for major navigation. Label multiple navs and avoid wrapping trivial link groups.

Key Takeaways

  • Role: <nav> marks major navigation as a landmark.
  • Structure: lists + links are the usual pattern; breadcrumbs often use <ol>.
  • A11y: label multiple navs; do not add a redundant navigation role.
  • Practice: fewer, clearer navs beat wrapping every link set.

One line: use <nav> for major link blocks, and name each landmark when you have more than one.

Default CSS Settings

User-agent stylesheets typically treat <nav> like other sectioning blocks:

default.css
nav {
  display: block;
}

Layout (horizontal bar, sidebar, sticky header) comes from your CSS — not from the tag itself.

Frequently Asked Questions

The nav element marks a major block of navigation links — site menus, tables of contents, indexes, or breadcrumbs. Assistive technology can jump to it as a navigation landmark.
No. nav supports only the global HTML attributes. Use aria-label or aria-labelledby when a page has more than one nav so each landmark has a clear name.
No. Reserve nav for major navigation. A short list of links in a footer or paragraph does not always need its own nav.
It is common and clear, but not required. nav can contain lists, headings, or prose with links. Lists help convey structure to users and CSS.
By default nav has the implicit navigation role. Do not add role="navigation" yourself — it is redundant. Other roles are not permitted on nav.
Yes. For example one for primary site links and one for on-page sections. Label each with aria-label (or aria-labelledby) so landmarks stay distinct.

Next: nextid

Continue with the next HTML tag in the series.

nextid tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful