Course contentsShow
← Web Development
Lesson 48 of 2,9822. HTML FundamentalsFree lesson

The <nav> Element

Marking up navigation sections with <nav> for major navigation blocks.

The <nav> Element

You'll learn how to mark up navigation menus so both browsers and assistive technologies understand where your site's main navigation lives.

What Is the <nav> Element?

The <nav> element is a semantic HTML container specifically designed to wrap major navigation blocks on your website. Think of it like labeling the signpost area of a building — it tells everyone "this is where you find directions to other places."

While you could use a generic <div> for navigation links, using <nav> clearly communicates intent: "This section contains navigation links to other pages or sections."

Why Use <nav>?

Just as <header> gives meaning to your page's introductory content, <nav> gives meaning to your navigation. This helps:

  • Screen readers announce navigation landmarks, letting users jump directly to menus
  • Search engines understand your site structure better
  • Future developers (including you!) instantly recognize navigation sections

When to Use <nav>

Use <nav> for major navigation blocks like:

  • Your main site menu (Home, About, Services, Contact)
  • Table of contents within a long article
  • Breadcrumb navigation

Don't use it for every single group of links — footer links or social media icons typically don't need <nav>.

Example Structure

<nav>
  <!-- Navigation links go here -->
</nav>

You place your navigation links inside the <nav> tags, just like you placed introductory content inside <header>.

Key Takeaway: The <nav> element semantically marks major navigation sections, making your site more accessible and your code's purpose clearer to browsers, assistive technologies, and other developers.