Skip to content

How to Label Multiple Nav Landmarks in HTML for Site and Footer Menus

admin8 min read
Two menu ribbons with distinct markers showing how to label multiple nav landmarks in HTML

To label multiple nav landmarks in HTML, give each <nav> its own accessible name. Use aria-labelledby pointing at a visible heading when one exists, or aria-label when no visible text fits. Without names, a site menu and a footer menu are both listed as plain “Navigation” in a screen reader’s landmark list, and the reader cannot tell which is which. The input is a page with two <nav> elements, and the output is the same page where each one has a short, distinct name. You can edit and preview the markup in the HTML Code Editor, but its preview is visual only, so it will not show or test the names.

Two identical blank signposts at a crossroads representing unnamed navigation landmarks

Why two unnamed nav menus both show up as “Navigation”

Every <nav> element exposes a navigation landmark, a region that assistive technology can list so people can jump straight to it. The HTML Standard describes nav as a section with navigation links, and the landmark role comes with the element automatically. The trouble starts when a page has more than one. A landmark list shows each region’s role and, if one exists, its name. With no name, a header menu and a footer menu are both listed as just “Navigation”.

<header>
  <nav>
    <ul>
      <li><a href="/">Home</a></li>
      <li><a href="/products">Products</a></li>
    </ul>
  </nav>
</header>
<main><h1>Welcome</h1></main>
<footer>
  <nav>
    <ul>
      <li><a href="/contact">Contact</a></li>
      <li><a href="/privacy">Privacy</a></li>
    </ul>
  </nav>
</footer>

On screen these two menus look different, but a screen reader user browsing the landmark list sees two identical entries and has to enter each one to find out what it contains. The W3C ARIA Authoring Practices Guide recommends distinguishing landmarks of the same role with unique labels. Treat that as a usability best practice, not a claim that every unlabeled <nav> fails WCAG. The WAI technique H97 covers grouping related links with the nav element, and naming is the extra step that keeps several of them usable.

Two folders receiving distinct tags to show naming each navigation landmark

How to label multiple nav landmarks in HTML

The quickest fix is aria-label, which supplies an accessible name as a string when there is no suitable visible label. Add it to each <nav> with a different value.

<header>
  <nav aria-label="Main">
    <ul>
      <li><a href="/">Home</a></li>
      <li><a href="/products">Products</a></li>
    </ul>
  </nav>
</header>
<footer>
  <nav aria-label="Footer">
    <ul>
      <li><a href="/contact">Contact</a></li>
      <li><a href="/privacy">Privacy</a></li>
    </ul>
  </nav>
</footer>

Both menus now have names, “Main” and “Footer”. You do not need role="navigation" on these elements, because <nav> already carries that role.

When a visible heading already describes the menu, prefer aria-labelledby. It points at the heading’s id, so the visible text and the accessible name are the same string and cannot drift apart when someone edits one of them.

<footer>
  <nav aria-labelledby="footer-nav-heading">
    <h2 id="footer-nav-heading">Support</h2>
    <ul>
      <li><a href="/contact">Contact</a></li>
      <li><a href="/privacy">Privacy</a></li>
    </ul>
  </nav>
</footer>

A heading placed inside a <nav> is not by itself a dependable way to name the landmark, so associate it explicitly as shown. Two details need care. The id must be unique in the document and the aria-labelledby value must match it exactly, otherwise the name may come out empty. If you author pages in a visual editor, confirm your ids survive, because one guide covers how the WYSIWYG source view removes class and id attributes. Keep the surrounding outline sensible too, as described in the guide on WYSIWYG heading levels out of order.

Short blank name tags pinned in a row representing concise landmark names

Choose short names that do not repeat the role

Assistive technology already announces the role, so a name such as “Main navigation” can be read out as “Main navigation navigation”. Name the purpose instead and let the role speak for itself.

NameProblemBetter
Main navigationRepeats the roleMain
MenuToo vague when a second menu existsProducts
LinksSays nothing about purposeSupport
Footer on both menusTwo different menus share one nameFooter and Legal

Keep names short, describe what the links are for, and write them in the page language. An aria-label value is not visible, so it is easy to forget when you translate a page. If two <nav> elements contain identical links and serve the same purpose, such as a repeated menu at the top and bottom, WAI recommends giving both the same name. Different names would suggest different content where there is none.

Labeling is only half the decision. The HTML Standard notes that not every group of links belongs in a nav element. A short, miscellaneous list of footer links often needs only the <footer> element, not a second <nav>. If your footer holds just a privacy link and a contact link, skipping the extra landmark means one fewer entry in the landmark list.

<footer>
  <p><a href="/contact">Contact</a> | <a href="/privacy">Privacy</a></p>
</footer>

Keep the footer <nav> when its links form a genuine navigation section, such as grouped sitemap links, and then give it a name. The earlier examples retain it for that reason. Decide from the purpose of the links, not from a rule that footers must or must not contain a navigation landmark.

Edit and preview the example in the HTML Code Editor

You can rehearse the change before touching a real site. Follow these steps in the HTML Code Editor:

  1. Open the editor and paste the labeled example, wrapped in a basic page with a heading and a <main> element.
  2. Change “Main” and “Footer” to your own names, and try both aria-label and aria-labelledby.
  3. Use the sandboxed live preview to confirm the markup renders and the links appear in the right place.
  4. If the indentation gets messy, run the markup through the HTML Beautifier. It improves layout but does not repair invalid code.

Here is the limit that matters. The preview is visual. An aria-label value is never drawn on screen, so a page with careful names and a page with none look identical. The editor also has no validation or linting, so a misspelled id in aria-labelledby passes without any warning. Treat the editor as a place to write and view markup, then check the accessible names elsewhere. If you also test responsive styles there, a related guide explains why the preview media query uses iframe width.

Check the names after you label multiple nav landmarks in HTML

Syntax, accessible names and real usability are separate checks. Valid markup does not prove a name exists, and a name that exists does not prove it is helpful. Work through these steps:

  1. Open the page in a browser and use its accessibility tools. The Firefox Accessibility Inspector shows the accessibility tree, so you can select each <nav> and confirm the role is navigation and the name is the text you intended. Other browsers offer comparable views, so check their documentation.
  2. Look for empty names, such as a <nav> with no label or an aria-labelledby value that points at nothing.
  3. Search the source for duplicate ids and for two different menus that share the same name.
  4. Where possible, open the landmark list in a screen reader and confirm each entry shows its own name and the navigation role. The exact wording and order vary between screen readers, so judge whether the entries are distinguishable, not whether they match a script.

Repeat the check after any template change, because a CMS or build step can drop or rename attributes. Retest whenever you add a third menu, such as breadcrumbs or a table of contents, since every new <nav> needs a name that differs from the others.

Frequently asked questions

Do two nav elements without names fail WCAG?

Not automatically. Naming distinct navigation landmarks is a W3C WAI best practice that helps people tell menus apart, but it is not a claim that every unlabeled nav element violates WCAG. Add names whenever the menus serve different purposes.

Should I use aria-label or aria-labelledby on a nav?

Use aria-labelledby when a visible heading already describes the menu, because the visible text and the accessible name stay identical. Use aria-label when there is no suitable visible label. Either way, each menu with a different purpose should get a different name.

Do I need role="navigation" on a nav element?

No. The nav element already maps to the navigation landmark role, so adding the role is redundant. Spend the effort on a clear accessible name instead.

Should the label include the word navigation?

Avoid it. Assistive technology also conveys the role, so a name like Main navigation may be announced with the word twice. A short purpose name such as Main, Footer or Support is clearer.

What if the top and bottom menus contain the same links?

If two nav elements contain identical links and serve the same purpose, WAI recommends giving both the same name. Different names would suggest the menus differ when they do not.

Does every footer need a nav element?

No. The HTML Standard says a short list of miscellaneous footer links often needs only the footer element, not a second nav. Keep and name a footer nav when its links form a real navigation section, such as grouped sitemap links.

Does the HTML Code Editor preview show accessible names?

No. The sandboxed live preview shows how the markup renders visually, and the editor has no validation. Check roles and computed names in a browser’s accessibility tools, and ideally with a screen reader’s landmark list.

Next steps

To label multiple nav landmarks in HTML, name each <nav> by purpose, use aria-labelledby when a visible heading exists, use aria-label otherwise, and skip the role and the word “navigation” in the name. Drop the second landmark when a footer holds only a few miscellaneous links. Your next step is to paste the example into the HTML Code Editor, rename the menus for your own site, and then confirm each role and computed name in your browser’s accessibility inspector.

Related tools and resources on HTML Editor Online:

Sources and further reading

Try it in your browser

Free online editors with syntax highlighting. Open one and start coding, no account needed.

All Tools