Constraint width child UL of a LI in a dropdown menu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Constraint width child UL of a LI in a 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">
.menu>li {
   float:left;
   margin-right:2em;
   position:relative;
}

.sub-menu {
   display:none;
   position:absolute;
   width:100%;
}

.menu>li:hover .sub-menu {
   display:block;
}
</style> <!--from   w w w  .ja v a  2  s . com-->
 </head> 
 <body> 
  <ul class="menu"> 
   <li> <a>Lorem ipsu</a> 
    <ul class="sub-menu"> 
     <li> <a>Lorem ipsum do</a> </li> 
     <li>Lorem ipsum dol</li> 
    </ul> </li> 
   <li> <a>Lorem ipsum</a> </li> 
   <li> <a>Lorem ips</a> </li> 
  </ul>  
 </body>
</html>

Related Tutorials