Create drop down menu with ul inside li - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Create drop down menu with ul inside li

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">
ul {<!--from   ww  w .  ja v  a2  s .c  om-->
   font-family:Arial, Verdana;
   font-size:15px;
   margin:0;
   padding:0;
   list-style:none;
   z-index:2;
}

ul li {
   display:block;
   position:relative;
   float:left;
}

li ul {
   display:none;
}

ul li a {
   display:block;
   text-decoration:none;
   color:Chartreuse;
   border-top:2px solid yellow;
   padding:6px 16px 6px 16px;
   background:blue;
   margin-left:2px;
   white-space:nowrap;
}

ul li a:hover {
   background:pink;
}

li:hover ul {
   display:block;
   position:absolute;
}

li:hover li {
   float:none;
   font-size:12px;
}

li:hover a {
   background:OrangeRed;
}

li:hover li a:hover {
   background:grey;
}

.dpdwn ul {
   display:none;
}

.dpdwn:hover ul {
   display:block;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li class="dpdwn"> <a>Lorem </a> 
    <ul> 
     <li> <a>Lorem i</a> </li> 
    </ul> </li> 
   <li> <a>Lor</a> </li> 
   <li> <a>Lore</a> </li> 
  </ul>  
 </body>
</html>

Related Tutorials