start learning
Image 1
3201

HTML Nav tag

The HTML <nav> tag represents a section of a web page that contains navigation links. It's used to define a navigation menu, typically containing links to various pages or sections of a website. The <nav> tag is employed to mark content that serves as navigation for users to move around different parts of the site.

Here's an example of how the <nav> tag can be used in an HTML document:


<!DOCTYPE html>
<html>
<head>
    <title>Sample Page</title>
</head>
<body>
    <header>
        <!-- Header content here including h1 heading title -->
        <nav>
            <ul>
                <li><a href="#">Home</a></li>
                <li><a href="#">About</a></li>
                <li><a href="#">Services</a></li>
                <li><a href="#">Contact</a></li>
            </ul>
        </nav>
    </header>

    <main>
        <!-- Main content of the page -->
    </main>
    <footer>
        <!-- Footer content here -->
    </footer>
</body>
</html>

In this example, the <nav> tag contains a list of navigation links in an unordered list (<ul>) format. This is a common way to structure navigation menus.

Using the <nav> tag helps enhance the semantic structure of your HTML document, making it clear to both human readers and search engines that the content within the <nav> element represents navigation links. This can improve accessibility by allowing screen readers and other assistive technologies to identify and properly convey the navigation to users.

×