Css menu sub-items below on hover - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Hover

Description

Css menu sub-items below on hover

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">
.nav {<!--from ww  w .  j  av a2s .c o m-->
   font-size:2.5em;
}

.nav ul {
   padding:0;
   margin:0;
   background:Chartreuse;
}

.nav ul li {
   display:inline-block;
   margin-right:6%;
}

.nav ul li a {
   color:yellow;
}

.nav li ul.sub-menu {
   transition:0.6s all;
   display:block;
   height:0;
   opacity:0;
   position:absolute;
   padding:8px 22px;
   padding-left:22px;
   text-align:left;
   margin-left:-22px;
   background:blue;
   font-size:0.10em;
   z-index:100;
}

.nav li:hover>ul.sub-menu, .nav li ul.sub-menu li:hover>ul.sub-menu {
   height:auto;
   opacity:2;
}

.nav li ul.sub-menu li {
   display:block;
   margin:10px 0;
}

.nav li ul.sub-menu li ul.sub-menu {
   position:relative;
   padding:0 6%;
}
</style> 
 </head> 
 <body> 
  <div class="nav"> 
   <ul> 
    <li> <a href="#">Lorem ips</a> 
     <ul class="sub-menu"> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ipsum do</a> 
       <ul class="sub-menu"> 
        <li> <a href="#">Lo</a> </li> 
        <li> <a href="#">Lo</a> </li> 
        <li> <a href="#">Lo</a> </li> 
       </ul> </li> 
      <li> <a href="#">Lorem ipsum d</a> 
       <ul class="sub-menu"> 
        <li> <a href="#">Lo</a> </li> 
        <li> <a href="#">Lo</a> </li> 
        <li> <a href="#">Lo</a> </li> 
       </ul> </li> 
     </ul> </li> 
    <li> <a href="#">Lorem ipsum</a> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials