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.
Placement | Block |
---|---|
Content | Block, inline, and text |
Version | New in HTML5 |
Start/End Tag | Start tag: required, End tag: required |
The basic syntax of the <nav> tag is given with −
HTML / XHTML: <nav> ... </nav>
The example below shows the <nav> tag in action.
<!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>
Note The nav tag is not supported all web browser.
The <nav> tag doesn't have any specific attribute.
Like all other HTML tags, the <nav> tag supports the global attributes in HTML5.
The <nav> tag is supported in all major modern browsers.
The <nav> tag also supports the event attributes in HTML5.