Hover to show sub list item - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Hover to Show

Description

Hover to show sub list item

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">
#cssmenu {<!--   w  w w  . j  a  v  a 2 s .  c o m-->
   background:Chartreuse;
   width:271PX;
}

#cssmenu>ul {
   padding:2px 0;
   margin:0px;
   list-style:none;
   width:271px;
   height:22px;
   font:normal 9pt verdana, arial, helvetica;
}

#cssmenu>ul li {
   margin:0;
   padding:0;
   display:block;
   float:left;
   position:relative;
   width:271px;
}

#cssmenu>ul li a:link, #cssmenu>ul li a:visited {
   padding:5px 0;
   display:block;
   text-align:center;
   text-decoration:none;
   background:yellow;
   color:blue;
   width:271px;
   height:14px;
}

#cssmenu>ul li:hover a, #cssmenu>ul li a:hover, #cssmenu>ul li a:active {
   padding:5px 0;
   display:block;
   text-align:center;
   text-decoration:none;
   background:pink;
   color:OrangeRed;
   width:271px;
   height:14px;
}

#cssmenu>ul li ul {
   margin:0;
   padding:0px 0px 0;
   list-style:none;
   display:none;
   background:grey;
   width:271px;
   position:absolute;
   top:22px;
   left:0px;
}

#cssmenu>ul li:hover ul {
   display:block;
   width:271PX;
}

#cssmenu>ul li ul li {
   width:147px;
   clear:left;
   width:271px;
}

#cssmenu ul li ul li:last-child a {
   background:red
}

#cssmenu>ul li ul li a:link, #cssmenu>ul li ul li a:visited {
   clear:left;
   padding:5px 0;
   width:271px;
   position:relative;
   z-index:1001;
}

#cssmenu>ul li ul li:hover a, #cssmenu>ul li ul li a:active, #cssmenu>ul li ul li a:hover {
   clear:left;
   background:BlueViolet;
   padding:5px 0;
   width:271px;
   position:relative;
   z-index:1001;
}
</style> 
 </head> 
 <body> 
  <div id="cssmenu"> 
   <ul> 
    <li> <a href="#"> <span>Lorem ip</span> </a> 
     <ul> 
      <li> <a href="#"> <span>Lorem ips</span> </a> </li> 
      <li> <a href="#">Lorem ips</a> </li> 
     </ul> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials