The HTML <nav>
tag is used for declaring a navigational section of the HTML document.
Websites typically have sections dedicated to navigational links - links that enable the user to navigate the site. These links should be placed inside a <nav>
tag.
Websites often have footer links such as terms of service, the home page, and a copyright page. It is sufficient to enclose these types of links inside <footer>
tags - no need to use <nav>
tags.
The <nav>
tag was introduced in HTML 5.
The following examples demonstrate usage of the <nav>
tag.
<nav>
<a href="/css/" target="_blank">CSS</a> |
<a href="/html/" target="_blank">HTML</a> |
<a href="/javascript/" target="_blank">JavaScript</a> |
<a href="/sql/tutorial/" target="_blank">SQL</a>
</nav>
HTML tags can contain one or more attributes. Attributes are added to a tag to provide the browser with more information about how the tag should appear or behave. Attributes consist of a name and a value separated by an equals (=) sign, with the value surrounded by double quotes. Here's an example, style="color:black;"
.
There are 3 kinds of attributes that you can add to your HTML tags: Element-specific, global, and event handler content attributes.
The attributes that you can add to this tag are listed below.