CSS Dropdown menu displaying - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

CSS Dropdown menu displaying

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">
* {<!--  w  w  w.  j av  a 2 s .c o m-->
   box-sizing:border-box;
   padding:0;
   margin:0;
}

#nav {
   background:Chartreuse;
   position:relative;
}

#nav ul {
   display:flex;
   position:relative;
}

#nav ul li {
   list-style:none;
   float:left;
   position:relative;
}

#nav ul li:hover {
   background:yellow;
}

#nav ul li>ul {
   position:absolute;
}

#nav ul li:hover>ul {
   display:block;
}

#nav a {
   text-decoration:none;
   font-family:Verdana;
   color:blue;
   display:block;
   clear:both;
   padding:11px 21px;
}

#nav ul ul {
   display:none;
   position:absolute;
   left:0;
}

#nav ul ul li {
   background:pink;
   display:block;
   width:100%;
}
</style> 
 </head> 
 <body> 
  <div id="nav"> 
   <ul> 
    <li> <a href="#">Lore</a> 
     <ul> 
      <li> <a href="#">Lore</a> </li> 
      <li> <a href="#">Lore</a> </li> 
     </ul> </li> 
    <li> <a href="#">Lorem </a> </li> 
    <li> <a href="#">Lorem i</a> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials