nav Tag HTML
HTML nav tag (<nav>
) is used to define a section of an html document that includes navigation links. It represents a block of navigation links that typically appear as a menu of a website. Remember that it’s not necessary to add all the links of a document inside the <nav>
tag.
Here is how you can add <nav>
tag in your HTML Document.
Example
<html> <head> </head> <body> <h1>HTML Navigation bar</h1> <nav> <ul> <li><a href="#link">Home</a></li> <li><a href="#link">About</a></li> <li><a href="#link">Products</a></li> <li><a href="#link">Contact</a></li> </ul> </nav> </body> </html>
Code Explanation
In an above code, the <nav>
tag encloses an unordered list (<ul>
) that contains a series of list items (<li>
). Each list item represents a navigation link, and the <a>
tags within the list items define the actual clickable links. You can adjust the URLs in the href
attributes to match the appropriate destinations.
HTML <nav>
tag is supported by almost all major browsers.
Share This Post!
nav Tag HTML