Centered drop down css menu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Centered drop down css 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 {<!-- ww  w.  j a  va2s. c  o m-->
   width:100%;
   background:Chartreuse;
   text-align:center;
   z-index:0;
}

#menu>li {
   display:inline-block;
   position:relative;
   line-height:36px;
   list-style-type:none;
}

#menu li a {
   display:block;
   text-decoration:none;
   padding:0px 11px;
   color:yellow;
   text-align:center;
}

#menu li ul {
   position:absolute;
   top:36px;
   width:auto;
   background-color:blue;
   z-index:2;
   list-style-type:none;
   padding-right:41px;
}

#menu li ul li ul {
   top:0;
   left:151px;
}

#menu li ul li a:hover {
   background:pink;
}

#menu li ul {
   display:none;
}

#menu li:hover>ul {
   display:block;
}
</style> 
 </head> 
 <body> 
  <div> 
   <ul id="menu"> 
    <li> <a href="#">Lore</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 i</a> 
     <ul> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem </a> </li> 
      <li> <a href="#">Lorem </a> </li> 
     </ul> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials