Create two level vertical menu with CSS - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu

Description

Create two level vertical menu with CSS

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">

#main-menu-wrap {
   position: absolute;
   top: 150px;
   z-index: 9999;<!--from w  w  w . j a  v  a 2  s  .  c om-->
}
#my li .sub-menu {
   border-top: 15px solid #80806E;
   display: none;
   position: absolute;
   z-index: 9999;
}
.home #my li a:hover {
   background: none repeat scroll 0 0 black;
   color: #1CBBED;
}
.home #my li li a:hover {
   background: none repeat scroll 0 0 transparent;
}
#my li a:hover, #my li:hover a {
   background: none repeat scroll 0 0 #80806E;
   color: white;
}
#my li li a:hover {
   background: none repeat scroll 0 0 transparent;
}
#my li:hover .sub-menu {
   display: block;
}
#my .sub-menu li {
   background: none repeat scroll 0 0 white;
   float: none;
   font-size: 14px;
   margin-bottom: 1px;
   padding: 10px;
   text-transform: uppercase;
   width: 200px;
}
#my .sub-menu li:hover {
   background: none repeat scroll 0 0 #E5E5E6;
}
#my .sub-menu a {
   color: #1CBBED !important;
   padding: 0;
   text-decoration: none;
}


      </style> 
 </head> 
 <body> 
  <div id="main-menu-wrap"> 
   <ul id="my" class="my-container"> 
    <li id="menu-item-429" class="menu-item"> <a href="blabla"> About us <span class="sub"></span> </a> 
     <ul class="sub-menu"> 
      <li id="menu-item-435" class="menu-item"> <a href="blablbala"> Team <span class="sub">aaa</span> </a> </li> 
      <li id="menu-item-145" class="menu-item menu-item-type-taxonomy"> <a href="blablabla"> haha <span class="sub">dddd</span> </a> </li> 
     </ul> </li> 
    <li id="menu-item-407" class="menu-item "> <a href=""> blablbala <span class="sub"></span> </a> 
     <ul class="sub-menu"> 
      <li id="menu-item-460" class="menu-item"> <a href=""> </a> </li> 
      <a href=""> <li id="menu-item-458" class="menu-item"> </li> <li id="menu-item-439" class="menu-item"> </li> </a> 
     </ul> <a href=""> </a> </li> 
    <a href=""> <li id="menu-item-444" class="menu-item"> </li> <li id="menu-item-5" class="menu-item menu-item-type-custom"> </li> </a> 
   </ul> 
   <a href=""> </a> 
  </div> 
  <a href=""> </a>  
 </body>
</html>

Related Tutorials