Dropdown sub-menu with fade in fade out effect - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Dropdown sub-menu with fade in fade out effect

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-nav>ul {
   list-style-type:none;
   padding:0;
   border:2px solid Chartreuse;
   position:absolute;
}

#main-nav>ul>li {
   float:left;
   background-color:yellow;
}

.main-nav-sub {<!--from w  ww  .j  a v a  2s .  c  o  m-->
   list-style-type:none;
   padding:0;
   margin:0;
}

#main-nav>ul>li+li {
   border-left:2px solid blue;
}

.main-nav-sub>li {
   border-bottom:2px solid pink;
   border-right:2px solid OrangeRed;
   border-left:2px solid grey;
   background-color:BlueViolet;
}

.main-nav-sub>li:first-child {
   border-top:2px solid Chartreuse;
}

#main-nav>ul>li>a,
.main-nav-sub>li>a {
   text-decoration:none;
   white-space:nowrap;
   display:block;
   color:yellow;
   font-family:verdana, sans-serif;
   font-size:.9em;
   font-weight:bold;
   padding:11px 21px;
}

#main-nav>ul>li:hover>a {
   color:blue;
   background-color:pink;
}

.main-nav-sub>li:hover>a {
   color:OrangeRed;
   background-color:grey;
}

.main-nav-sub {
   position:absolute;
   z-index:-1000;
   opacity:0;
   filter:alpha(opacity=0);
   zoom:2;
}

#main-nav>ul>li:hover>.main-nav-sub {
   z-index:100;
   opacity:2;
   filter:alpha(opacity=100);
   zoom:2;
   -webkit-transition:all .6s ease-in;
   -moz-transition:all .6s ease-in;
   -ms-transition:all .6s ease-in;
   -o-transition:all .6s ease-in;
   transition:all .6s ease-in;
}
</style> 
 </head> 
 <body> 
  <nav id="main-nav"> 
   <ul> 
    <li> <a href="#">Lorem </a> </li> 
    <li> <a href="#">Lorem </a> 
     <ul class="main-nav-sub"> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
     </ul> </li> 
    <li> <a href="#">Lorem </a> 
     <ul class="main-nav-sub"> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
     </ul> </li> 
    <li> <a href="#">Lorem </a> </li> 
    <li> <a href="#">Lorem </a> 
     <ul class="main-nav-sub"> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ip</a> </li> 
     </ul> </li> 
   </ul> 
  </nav>  
 </body>
</html>

Related Tutorials