create single level dropdown menu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

create single level dropdown menu

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
* {<!--   ww  w .  ja  v a 2  s  . c o m-->
   margin:0;
   padding:0;
}

#nav {
   list-style:none;
   height:3em;
}

#nav li {
   position:relative;
   float:left;
   width:193px;
   background:Chartreuse;
   text-align:center;
}

#nav li:hover {
   background:yellow;
}

#nav a {
   display:block;
   color:blue;
   text-decoration:none;
   line-height:3em;
}

#nav ul {
   position:absolute;
   left:-1000em;
   top:3em;
   list-style:none;
}

#nav li:hover ul {
   left:0;
   top:auto;
}
</style> 
 </head> 
 <body> 
  <ul id="nav"> 
   <li> <a href="#">Lorem</a> </li> 
   <li> <a href="#">Lorem</a> 
    <ul> 
     <li> <a href="#">Lorem</a> </li> 
     <li> <a href="#">Lorem</a> </li> 
     <li> <a href="#">Lorem</a> </li> 
    </ul> </li> 
   <li> <a href="#">Lorem</a> </li> 
  </ul>  
 </body>
</html>

Related Tutorials