The <nav> element in HTML is used to set navigation links in an HTML document. This tag introduced in HTML5.
Let us now see an example to implement <nav> tag in HTML −
Example
<!DOCTYPE html> <html> <body> <nav> <a href="/tutorialslibrary/">Tutorials</a> | <a href="/programming_examples/">Codes</a> | <a href="/online_dev_tools/">Tools</a> | <a href="/articles/">Articles</a> | <a href="/questions/index.php/">QA</a> | <a href="/current_affairs/index.htm/">Current Affairs</a> </nav> </body> </html>
Output
Above, we have set some hyperlinks with <a> tag and href attribute −
<a href="/tutorialslibrary/">Tutorials</a> | <a href="/programming_examples/">Codes</a> | <a href="/online_dev_tools/">Tools</a> | <a href="/articles/">Articles</a> | <a href="/questions/index.php/">QA</a> | <a href="/current_affairs/index.htm/">Current Affairs</a>
To arrange them properly, we have used the <nav> element −
<nav> <a href="/tutorialslibrary/">Tutorials</a> | <a href="/programming_examples/">Codes</a> | <a href="/online_dev_tools/">Tools</a> | <a href="/articles/">Articles</a> | <a href="/questions/index.php/">QA</a> | <a href="/current_affairs/index.htm/">Current Affairs</a> </nav>