Spread the love

HTML <nav> Tag

The HTML <nav> Tag is used to represent a section that contains navigation links, either within the current document or in another document. Examples of some navigation links are menu, table of contents, index, etc. They have to be made clear.

The <nav> Tag is a newly added tag in HTML5.

Note:- You can use multiple links within a page, but all links must be placed inside the nav tag. The <nav> Tag should contain only one major block of navigation links.

Example:-

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        HTML Nav Tag
    </title>
</head>
<style type="text/css">
*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
nav{
background: lightblue;
}
nav ul{
    padding: 0;
    text-align: center;
}
  nav ul li{
    list-style: none;
    display: inline-block;
    padding: 10px 50px;
    font-size: 25px;
  }
</style>
<body>
<h1 style="margin-bottom: 50px;text-align: center ;">This is HTML nav Example</h1>    

<nav>
    <ul>
        <li><a>Home</a></li>
        <li><a>About</a></li>
        <li><a>Gallery</a></li>
        <li><a>Contact</a></li>
    </ul>
</nav>

</body>
</html>

Output:-

Sticky Header on Scroll Only HTML and CSS


Spread the love

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *