Dropdown sub menu auto width - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Dropdown sub menu auto width

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">
body {<!--from ww w.  ja v a 2  s.c om-->
   position:relative;
}

.dropdown {
   display:inline-block;
   margin:0 13px;
}

.dropdown-content {
   display:none;
   position:absolute;
   background:white;
   width:auto;
   padding:13px 17px;
   z-index:2;
}

.dropdown:hover .dropdown-content {
   display:block;
}

.subm {
   margin:13px 0;
}
</style> 
 </head> 
 <body> 
  <div class="dropdown"> 
   <span>Lorem ipsum </span> 
   <div class="dropdown-content"> 
    <div class="subm"> 
     <a class="menulink" href="#ingredients">Lorem ipsum</a> 
    </div> 
    <div class="subm"> 
     <a class="menulink subm" href="#ingredients">Lorem ipsum dolo</a> 
    </div> 
    <div class="subm"> 
     <a class="menulink subm" href="#ingredients">Lorem ipsum dolor</a> 
    </div> 
    <div class="subm"> 
     <a class="menulink subm" href="#ingredients">Lorem ips</a> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials