HTML5 - Nav Tag




HTML5 Nav Tag

The HTML5 nav element is used to semantically mark the navigation section or sections of a page.

The <nav> element defines a section of navigation links (i.e. links to other pages or to parts within the page itself) in a document.

The following table summarizes the usages context and the version history of this tag.

For Example
Placement Block
Content Block, inline, and text
Version New in HTML5
Start/End Tag Start tag: required, End tag: required

Syntax

The basic syntax of the <nav> tag is given with −

HTML / XHTML: <nav> ... </nav>

The example below shows the <nav> tag in action.

Example

<!DOCTYPE html>
<html>
<body>
<nav>
<a href="#">HTML</a> |
<a href="#">JAVA</a> |
<a href="#">PHP</a> |
<a href="#">PYTHON</a> |
<a href="#">JavaScript</a>
</nav>
<p><strong>Note</strong> The nav tag is not supported all web browser.</p>
</body>
</html>

Result

Note The nav tag is not supported all web browser.

Tag-Specific Attributes

The <nav> tag doesn't have any specific attribute.

Global Attributes

Like all other HTML tags, the <nav> tag supports the global attributes in HTML5.

Browser Compatibility

The <nav> tag is supported in all major modern browsers.

Event Attributes

The <nav> tag also supports the event attributes in HTML5.