Semantic Elements

HTML <nav> element

Groups a major collection of navigation links. Not every group of links requires nav. Use nav for primary or otherwise significant navigation. Label multiple navigation landmarks distinctly, for example Main and Breadcrumbs. Link lists can still be marked up with ul and li inside nav. It accepts global HTML attributes; individual global features may be inapplicable or restricted.

Formal Syntax & Structure

html syntaxhtml
<nav>Navigation links</nav>

Return Value

HTMLElement

Content model: Flow content; context-specific ancestor restrictions may apply.

Working Example

Example Snippethtml
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>HTML example</title>  </head>  <body>    <nav aria-label="Main">      <a href="#books">Books</a>    </nav>    <h2 id="books">Books</h2>  </body></html>
HTML Reference