<nav> Tag in HTML

The <nav> tag is used to define navigation links in a web page. It groups together links that help the user navigate through the website. It is typically used for main menus or sections with significant navigation items. The <nav> element is placed inside the <body> of the HTML document.

Key Points on <nav> Tag:

Syntax of <nav> Tag:

Syntax Example

<nav>...</nav>

Examples of <nav> Tag Usage:

1. Simple Navigation Menu

Code Example

<nav>
            <a href="#home">Home</a>
            <a href="#about">About</a>
            <a href="#services">Services</a>
            <a href="#contact">Contact</a>
        </nav>

2. Navigation with a List of Links

Code Example

<nav>
            <ul>
                <li><a href="#home">Home</a></li>
                <li><a href="#about">About</a></li>
                <li><a href="#services">Services</a></li>
                <li><a href="#contact">Contact</a></li>
            </ul>
        </nav>

Attributes of <nav> Tag:

The <nav> tag is an essential part of web design and accessibility. It helps organize links that lead users to other parts of the website, making navigation easier and more intuitive.