Write This HTML Code in Body Tag
<nav id="main-nav">
<ul id="nav-primary">
<li><a href="#">Menu 1</a>
<ul class="subnav">
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
</ul>
</li>
<li><a href="#">Menu 2</a>
<ul class="subnav">
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
</ul>
</li>
<li><a href="#">Menu 3</a>
<ul class="subnav">
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
</ul>
</li>
</ul>
</nav>
Write This CSS Code in Style Tag(Which is in Head Tag) or Write in External CSS File
#main-nav {
width: 100%;
height: 67px;
background: #f2f2f2;
}
#main-nav .subnav {
display: none;
position: absolute;
top: 67px;
left: 0px;
width: 100%;
list-style-type: none;
background: #fff;
margin: 0;
border:solid 1px #eeeeee;
padding:0;
}
#main-nav .subnav li {
display: block;
border-bottom: solid 1px #eeeeee;
margin:0;
}
#main-nav .subnav li a {
color: #333;
height:18px;
padding:10px 0;
font-size:13px;
}
#main-nav .subnav li a:hover {
background:#f9f9f9;
}
#nav-primary {
list-style: none;
margin: 0;
float: left;
padding:0;
}
#nav-primary li {
float: left;
position: relative;
}
#nav-primary li a {
float: left;
color: #000;
text-align: center;
font-size: 14px;
height: 48px;
padding-top: 19px;
line-height: 16px;
width: 164px;
text-decoration:none;
}
#nav-primary li a:hover {
text-decoration:none;
}
#nav-primary li:hover .subnav {
display: block;
}
OUTPUT
<nav id="main-nav">
<ul id="nav-primary">
<li><a href="#">Menu 1</a>
<ul class="subnav">
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
</ul>
</li>
<li><a href="#">Menu 2</a>
<ul class="subnav">
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
</ul>
</li>
<li><a href="#">Menu 3</a>
<ul class="subnav">
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
<li><a href="#">Lorem Ipsum Dolor</a>
</li>
<li><a href="#">Ham cow meatball pork chop</a>
</li>
</ul>
</li>
</ul>
</nav>
Write This CSS Code in Style Tag(Which is in Head Tag) or Write in External CSS File
#main-nav {
width: 100%;
height: 67px;
background: #f2f2f2;
}
#main-nav .subnav {
display: none;
position: absolute;
top: 67px;
left: 0px;
width: 100%;
list-style-type: none;
background: #fff;
margin: 0;
border:solid 1px #eeeeee;
padding:0;
}
#main-nav .subnav li {
display: block;
border-bottom: solid 1px #eeeeee;
margin:0;
}
#main-nav .subnav li a {
color: #333;
height:18px;
padding:10px 0;
font-size:13px;
}
#main-nav .subnav li a:hover {
background:#f9f9f9;
}
#nav-primary {
list-style: none;
margin: 0;
float: left;
padding:0;
}
#nav-primary li {
float: left;
position: relative;
}
#nav-primary li a {
float: left;
color: #000;
text-align: center;
font-size: 14px;
height: 48px;
padding-top: 19px;
line-height: 16px;
width: 164px;
text-decoration:none;
}
#nav-primary li a:hover {
text-decoration:none;
}
#nav-primary li:hover .subnav {
display: block;
}
OUTPUT
No comments:
Post a Comment