HTML nav element

Html nav element defines a block that contains the links related to the other pages or sections of the content in the same page.

Example

<nav>
 <ul>
   <li><a href="#"> Home </a></li>
   <li><a href="#"> News </a></li>
   <li><a href="#"> Channels </a></li>
  </ul>
</nav>
Try </>

You can also style navigation bar using CSS properties. CSS properties design the above navigation bar.

Example

<style>
ul{
 list-style-type:none;
	
}
ul li {
 display:inline-block;
 float:left;
}
 ul li a{
 text-decoration:none;
 padding:7px;
 background-color:rgba(255,0,0,0.5);
 color:rgb(255,255,255);
 border-right:1px solid black;

}
</style>


Try</>

Specific uses

It is usually used to make a navigation bar or a side bar. The navigation bar is made in such a way that user can find information on the website quickly and easily.

Related tags

AttributesDescription
<ul> defines an unordered list.
<ul> <li> unordered list </li> </ul>
<li> defines list item for a list.
<ul> <li> unordered list items </li> </ul>

Tag omission

Both opening and closing tags are necessary for the nav element.

Global Attributes

All the global attributes are applicable on the nav element.



Was this article helpful?

 

Email:

Message:

Get the newsletter