Fixing a CSS dropdown menu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Fixing a CSS dropdown menu

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">
#sidebar {<!-- w w w.  ja  va 2s  . c o m-->
   left:0;
   background-color:Chartreuse;
   height:16%;
   position:fixed;
   text-align:center;
   vertical-align:middle;
   right:0;
   top:0;
}

#sidebar ul {
   display:inline-block;
   color:yellow;
   font-family:'Raleway';
   letter-spacing:3px;
   font-size:21px;
   padding:36px;
   vertical-align:middle;
}

#sidebar li {
   position:relative;
   float:left;
   width:141px;
   text-align:center;
   vertical-align:middle;
   list-style:none;
}

#sidebar li a {
   color:blue;
   text-decoration:none;
   display:block;
   vertical-align:middle;
   padding:16px;
}

#sidebar li a:hover {
   color:pink;
}

#sidebar li:hover {
   color:OrangeRed;
}

#sidebar ul ul {
   padding:0;
   top:19px;
   visibility:hidden;
}

#sidebar ul li:hover ul {
   visibility:visible;
}

#sidebar ul ul li a {
   font-size:16px;
   background-color:grey;
}

#sidebar ul ul li a:hover {
   background-color:BlueViolet;
}
</style> 
 </head> 
 <body> 
  <div id="sidebar"> 
   <ul> 
    <li> <a href="#">Lorem </a> 
     <ul> 
      <li> <a href="#">Lorem i</a> </li> 
      <li> <a href="#">Lorem i</a> </li> 
      <li> <a href="#">Lore</a> </li> 
     </ul> </li> 
    <li> <a href="#">Lorem</a> 
     <ul> 
      <li> <a href="#">Lorem ip</a> </li> 
      <li> <a href="#">Lorem ips</a> </li> 
      <li> <a href="#">Lorem ipsum</a> </li> 
     </ul> </li> 
    <li> <a href="#">Lorem</a> 
     <ul> 
      <li> <a href="#">Lorem</a> </li> 
      <li> <a href="#">Lorem</a> </li> 
      <li> <a href="#">Lorem</a> </li> 
     </ul> </li> 
    <li> <a href="#">Lorem</a> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials