display a dropdown ul - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL

Description

display a dropdown ul

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">
* {<!--from w ww.  ja v a 2 s.  co m-->
   box-sizing:border-box;
}

#menu {
   position:absolute;
   left:81px;
   top:51%;
   transform:translate(0%,-51%);
   -webkit-transform:translate(0%,-51%);
}

#menu ul {
   list-style:none;
   position:relative;
   float:left;
   margin:0;
   padding:0;
   top:51%;
}

#menu ul li {
   display:inline;
   position:relative;
}

#menu ul li a {
   color:Chartreuse;
   text-decoration:none;
   font-family:'Cabin', sans-serif;
   background-color:yellow;
   position:relative;
   padding-top:13px;
   padding-bottom:11px;
   padding-right:11px;
   padding-left:11px;
   transition:background-color 0.3s ease-in-out;
}

#menu ul li a.news {
   color:blue;
   transition:color 0.3s ease-in-out;
}

#menu ul li a:hover.news {
   color:pink;
}

#menu ul li a:hover {
   background-color:OrangeRed;
   text-decoration:none;
   border-bottom:3px solid grey;
   color:BlueViolet;
}

#menu ul ul
 {
   display:none;
   position:absolute;
   top:100%;
   right:0%;
   margin-left:0px;
   text-align:center;
   width:351px;
   line-height:61px;
   margin-top:13px;
   background-color:Chartreuse;
   font-size:0;
}

#menu ul ul.longer {
   width:151px;
}

#menu ul ul li
 {
   font-size:2rem;
   float:none;
   width:51%;
   display:inline-block;
   background-color:yellow;
}

#menu ul ul a
 {
   display:block;
   padding:0px 6px;
   width:100%;
   background-color:blue;
}

#menu ul li:hover>ul
 {
   display:block;
}
</style> 
 </head> 
 <body> 
  <nav id="menu"> 
   <ul> 
    <li class="menu1"> <a href="">Lore</a> </li> 
    <li class="left"> <a href="">Lore</a> </li> 
    <li class="left"> <a href="">Lorem </a> </li> 
    <li class="left"> <a href="">Lorem</a> </li> 
    <li class="left"> <a href="">Lorem </a> </li> 
    <li class="left"> <a href="">Lore</a> </li> 
    <li class="left"> <a href="">Lorem ipsum d</a> </li> 
    <li class="left"> <a href="">Lore</a> </li> 
    <li class="left"> <a href="" class="news">Lore</a> 
     <ul> 
      <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> 
      <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