Note/Info The nav tag is a new tag in HTML5.
HTML5 <nav> tag
The <nav> tag defines an important block of navigation Links so that the users can easily navigate through the site.
All the links present inside the <nav> element should link to either –
- parts of the same page of the same HTML document.
- from one page of the current document to other pages of the HTML document within the same Website.
Examples of the usage of this tag are:
Table of Content
Index
menus
Syntax:
<nav>hyperlinks…</nav>
Example
<nav> <a href="#">Digital Marketing</a> | <a href="#">Salesforce</a> | <a href="#">Mainframe</a> | <a href="#">Java</a> </nav>
Default CSS Values
display: block;
How Browser will display
BLOCK Level.
Difference between HTML4.01, XHTML and HTML5
HTML4 | XHTML | HTML5 |
---|---|---|
NA | NA | New tag in HTML5 |
Attributes used with <nav> tag
NONE
Points to remember:
- You should place only the major block of navigation links inside this tag.
- You can place the block of common navigation links (which are not major) using the <footer> element.
- It is mostly used for primary navigation areas like main menu at the top of the page or side menu sometimes. There can be multiple <nav> tags like one to link other parts of same page, one for site navigation etc.
- Do not nest the <nav> tag inside the <address> tag.
- The <li> tag is often used inside the <nav> tag to create a navigation list.
Global Attributes
The <nav> tag supports Global attributes.
Event Attributes
The <nav> tag supports Event attributes.
Supporting Browsers
Related Tags
<div>, <a>, <details>, <section>, <article>, <address>, <ul>, <li>,<header> and<footer> tags.