Sub-menu vertically align - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu sub menu

Description

Sub-menu vertically align

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">
.navitem {<!--from   ww w .  ja va  2s  . c  o  m-->
   height:31px;
}

#menu ul {
   margin:0;
   padding:0;
   list-style-type:none;
   text-align:center;
}

#menu li {
   background-color:Chartreuse;
   display:inline-block;
   padding:0;
   vertical-align:middle;
}

#menu li a {
   display:block;
   width:126px;
   color:yellow;
   text-decoration:none;
   line-height:31px
}

#menu li a:hover {
   color:blue;
}

#menu ul li ul {
   display:none;
}

#menu ul li:hover ul {
   display:block;
   margin:0px;
}

#menu li:hover ul li {
   float:none;
   display:block;
}

#menu li ul {
   position:absolute;
}

#menu {
   height:31px;
   margin-top:31px;
}

.table {
   display:table;
   margin:0 auto;
}

#logo {
   height:191px;
   width:267px;
   background-color:pink;
   margin:0 31px;
}
</style> 
 </head> 
 <body> 
  <div id="menu"> 
   <div class="table"> 
    <ul> 
     <li class="navitem"> <a href="#">Lorem ips</a> 
      <ul> 
       <li> <a href="#">Lorem ipsum</a> </li> 
       <li> <a href="#">Lorem ipsum</a> </li> 
       <li> <a href="#">Lorem ipsum</a> </li> 
      </ul> </li> 
     <li class="navitem"> <a href="#">Lorem i</a> </li> 
     <li id="logo"></li> 
     <li class="navitem"> <a href="#">Lorem ip</a> </li> 
     <li class="navitem"> <a href="#">Lorem i</a> </li> 
    </ul> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials