Which tag is used to group navigation links?
The <nav> tag is used to group navigation links in HTML.
Purpose:
The <nav> tag marks a navigation section of the page: a block containing the main links for moving around the site (menu, table of contents, navigation bar, and so on).
Example:
html
<nav>
<a href="index.html">Home</a>
<a href="about.html">About us</a>
<a href="services.html">Services</a>
<a href="contact.html">Contacts</a>
</nav>Features:
- Helps search engines and screen readers understand where the navigation links are.
- Several
<nav>tags can be used on a page (for example, the main menu and the footer). - Usually links (
<a>) or lists (<ul>,<li>) are placed inside<nav>.
Example with a menu list:
html
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/news">News</a></li>
<li><a href="/contacts">Contacts</a></li>
</ul>
</nav>Conclusion:
The <nav> tag is used to logically group navigation links, to mark a menu or navigation blocks on a site.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.