nav tag Navigation Menu

 

<nav> tag

The <nav> tag can create navigation menus on web pages. It is a semantic and block-level HTML element.

Navigation menu provides users with an easy and attractive way to access web pages.

Example:

<html>

<head>

<title>simple navigation</title></head>

<body>

<div style="width:100%; height:80px;background-color:gray; float:left"></div>

<div style="width:100%; height:30px;background-color:pink;float:left">

<nav>

<a href="#">HOME</a>

<a href="#">ABOUT US</a>

<a href="#">CONTACT</a>

</nav>

</div>

</body>

</html>

OUTPUT




Example

<html>

<head>

<title>formated navigation</title>

<style>

*{

margin:0px;

padding:0px;

}

.d1{

width:100%;

height:90px;

float:left;

background-image:linear-gradient(#ff0022,#f45,#ff0022);

}

h1{

text-align:center;

}

.d2{

width:100%;

height:40px;

float:left;

background-color:#ffaa22;

position:relative;

}

nav{

float:right;

}

li{

margin:3px;

width:120px;

height:30px;

float:left;

border:1px solid white;

line-height:30px;

list-style:none;

text-align:center;

border-radius:10px;

background-image:linear-gradient(#ff0022,#f45,#ff0022);

z-index:5;

display:block;

}

ul{

background-image:linear-gradient(#ff0022,#f45,#ff0022);

margin:3px;

padding:0px;

}

a{

text-decoration:none;

display:block;

}

a:hover{

background-color:red;

border-radius:10px;

color:#aaff22;

display:block;

}

.d3{

height:700px;

width:100%;

float:left;

background-image:linear-gradient(#fea,#ff5,#aff);

}

ul li ul li{

margin:0px;

padding:0px;

position:relative;

z-index:5;

float:none;

display:none;

position:relative;

}

ul li:hover > ul li {

display:block;

}

</style>

</head>

<body>

<div class ="d1"><h1>Bright Academe</div>

<div class="d2">

<nav>

<ul>

<li><a href="#">HOME</a></li>

<li><a href="#">ABOUT US</a>

<ul>

<li><a href="#">TT</a></li>

<li><a href="#">TD</a></li>

</ul></li>

<li><a href="#">CONTACT</a></li></ul>

</nav>

</div>

<div class ="d3"></div>

</body>

</html>

OUTPUT


Example:

<html>
<head>
<title>formated navigation</title>
<style>
*{
margin:0px;
padding:0px;
}
.d1{
width:100%;
height:90px;
float:left;
background-image:linear-gradient(#1100ff,#f45,#002f);
}
h1{
text-align:center;
line-height:90px;
color:silver;
font-size:50px;
}
.d2{
width:100%;
height:40px;
float:left;
background-image:linear-gradient(#19f,#f45,#19f);
}
nav{
float:right;
}
li{
margin:3px;
width:120px;
height:30px;
float:left;
border:1px solid white;
line-height:30px;
list-style:none;
text-align:center;
border-radius:10px;
background-image:linear-gradient(#ff0022,#f45,#ff0022);
z-index:5;
display:block;
}
ul{
background-image:linear-gradient(#ff0022,#f45,#ff0022);
margin:3px;
padding:0px;
}
a{
text-decoration:none;
display:block;
}
a:hover{
background-color:red;
border-radius:10px;
color:#aaff22;
}
.d3{
height:700px;
width:100%;
float:left;
background-image:url('i1.jpg');
background-size:100%,100%;
background-position:center;
}
ul li:hover > ul li {
display:block;
}
ul li ul li{
position:relative;
display:none;
}
</style>
</head>
<body>
<div class ="d1"><h1>Bright Academe</h1></div>
<div class="d2">
<nav>
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">ABOUT US</a>
<ul>
<li><a href="t1.html" target="if">Time table</a></li>
<li><a href="#">Teacher Info</a></li>
<li><a href="#" target="d33">Refresh</a></li>
</ul>
</li>
<li><a href="#">CONTACT</a></li></ul>
</nav>
</div>
<div class ="d3" name="d33">
<iframe width="100%" height="100%" name="if"></iframe></div>
</body>
</html>

OUTPUT











Comments

Popular posts from this blog

The structure of HTML and some basic tags

Frame tag and Example

Introduction and objective of HTML