Pure css dropdown menu sticky to top - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Pure css dropdown menu sticky to top

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">
#navigation {<!-- www .  j a  va 2  s.  c  om-->
   position:absolute;
   top:0;
   right:0;
   width:100%;
   border-bottom:3px solid Chartreuse;
   background:yellow;
   font-size:13px;
}

#navigation ul {
   list-style:none;
   margin:0;
   padding:.4em;
}

#navigation ul li {
   float:left;
   margin-right:.26em;
}

#navigation li a,#navigation li a:visited {
   color:blue;
   text-decoration:none;
   display:block;
   background-color:pink;
   border:2px solid OrangeRed;
   padding:.6em;
}

#navigation li a:hover {
   background-color:grey;
   color:BlueViolet;
   text-decoration:none;
}

#navigation li a:active {
   background-color:Chartreuse;
   color:yellow;
   text-decoration:none;
}

#navigation li ul {
   padding:0;
   display:none;
   position:absolute;
   padding-top:.6em;
}

#navigation li:hover ul {
   display:block;
}

#navigation li li {
   float:none;
   border-bottom:2px solid blue;
}

#navigation li li a {
   border:0;
}
</style> 
 </head> 
 <body> 
  <div id="navigation"> 
   <ul> 
    <li> <a href="#">Lore</a> </li> 
    <li> <a href="#">Lorem ip</a> </li> 
    <li> <a href="#">Lorem ip</a> </li> 
    <li> <a href="#">Lorem</a> </li> 
    <li> <a href="#">Lorem i</a> 
     <ul> 
      <li> <a href="#" class="first">Lorem ipsum</a> </li> 
      <li> <a href="#">Lorem ips</a> </li> 
      <li> <a href="#">Lorem</a> </li> 
      <li> <a href="#">Lorem i</a> </li> 
     </ul> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials