add Drop-Down Sub-Menu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

add Drop-Down Sub-Menu

Demo Code

ResultView the demo in separate window

<!doctype html>
<html>
 <head> 
  <style>
.nav, .sub {<!--   w  w  w. j av a 2s.c o m-->
   font-family:Arial, Helvetica, sans-serif;
   list-style:none;
   margin:0;
   padding:0;
}

.nav li {
   background:Chartreuse;
   height:41px;
   line-height:41px;
   text-align:center;
   width:161px;
}

.nav li a {
   display:block;
   text-decoration:none;
   color:yellow;
}

.nav li a:hover {
   background:blue;
}

.nav>li {
   border-right:2px solid pink;
   float:left;
}

.sub {
   display:none;
}

.nav>li:hover .sub {
   display:block;
}

.sub li {
   border-top:2px solid OrangeRed;
}
</style> 
 </head> 
 <body> 
  <ul class="nav"> 
   <li> <a href="#">Lore</a> </li> 
   <li> <a href="#">Lorem</a> </li> 
   <li> <a href="#">Lorem i</a> </li> 
   <li> <a href="#">Lorem ipsu</a> 
    <ul class="sub"> 
     <li> <a href="#">Lorem ipsum </a> </li> 
     <li> <a href="#">Lorem ipsum dol</a> </li> 
     <li> <a href="#">Lor</a> </li> 
    </ul> </li> 
   <li> <a href="#">Lorem ip</a> </li> 
  </ul>  
 </body>
</html>

Related Tutorials