The nav tag in HTML5
In this article we will learn how to use the nav tag in HTML5, which is a tag used to declare navigation link locations, usually menus or sidebar categories lists.
Note that not all navigation links are placed in the nav tag. The nav tag should only be used to wrap main navigation blocks such as page menus.
1. What is the nav tag in HTML?
In HTML, the nav tag is used to wrap the main navigation and link-related locations for the web page. Usually it will be the main menu, sub-menu, sidebar category list…
Nav is an acronym for navigation, its syntax is as follows:
2. How to use the nav tag in HTML
As I said above, we should only use the nav tag for the main navigation links for the website.
In the past, when creating menus, we often used ul tags and a tags as follows.
<div id="menu"> <ul> <li><a href="#">Home</a></li> ... </ul> </div>
But if we use the nav tag, we will change the structure to:
nav> <ul> <li><a href="#">Home</a></li> ... </ul> </nav>
Also nothing special, just change the outer
div tag to a
For example , use the nav tag to group a page's navigation menus.
So I have finished the tutorial on how to use the nav tag in HTML. This card is also simple, so I don't have too many examples for the lesson, hope you understand.