Description

The HTML element <nav> is used to define a section of navigational links.

The navigation links can be the links to other pages on a website or parts of the same web page, or even links to other websites.

The below table summarizes its usage.

Usage Details
Placement It is displayed as a Block element.
Contents It can contain Block elements, Inline elements, and text.
Tags Both the opening and closing tags are required.
Versions HTML 5

Syntax

Here is the basic syntax of the <nav> element.

<nav>...</nav>

Examples

Run this on IDE

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example - HTML Element nav</title>
</head>
<body>
    <nav>
        <ul>
            <li><a href="https://www.randomcodez.com">Home</a></li>
            <li><a href="https://www.randomcodez.com/about">About</a></li>
            <li><a href="https://www.randomcodez.com/search">Search</a></li>
            <li><a href="https://ide.randomcodez.com">IDE</a></li>
            <li><a href="https://tools.randomcodez.com">Tools</a></li>
        </ul>
    </nav>
</body>
</html>

Attributes

The following table shows the list of supported and unsupported attributes for the <nav> element.

Attribute Type Details
Element-Specific Attributes The tag <nav> doesn't have any element-specific attributes.
Global Attributes Like all other HTML tags, the tag <nav> supports the HTML Global Attributes.
Event Attributes The tags <nav> also supports the HTML Event Attributes.

Browser Compatibility

The tags <nav> is supported in all modern browsers.

  • Google Chrome 6+
  • Internet Explorer or Edge 9+
  • Firefox 4+
  • Apple Safari 5+
  • Opera 11.1+

Related Links