Create a drop down menu with only css and html - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Create a drop down menu with only css and html

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ip</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.nav ul ul {
   display:none;
}

.nav ul li:hover>ul {
   display:block;
}

.nav ul {<!--from   w  ww  .j av a 2s . c  o  m-->
   background:Chartreuse;
   background:linear-gradient(top, yellow 0%, blue 100%);
   background:-moz-linear-gradient(top, pink 0%, OrangeRed 100%);
   background:-webkit-linear-gradient(top, grey 0%,BlueViolet 100%);
   box-shadow:0px 0px 10px Chartreuse;
   padding:0 21px;
   border-radius:11px;
   list-style:none;
   position:relative;
   display:inline-table;
}

.nav ul:after {
   content:"";
   clear:both;
   display:block;
}

.nav ul li {
   float:left;
}

.nav ul li:hover {
   background:yellow;
   background:linear-gradient(top, blue 0%, pink 41%);
   background:-moz-linear-gradient(top, OrangeRed 0%, grey 41%);
   background:-webkit-linear-gradient(top, BlueViolet 0%,Chartreuse 41%);
}

.nav ul li:hover a {
   color:yellow;
}

.nav ul li a {
   display:block;
   padding:26px 41px;
   color:blue;
   text-decoration:none;
}

.nav ul ul {
   background:pink;
   border-radius:0px;
   padding:0;
   position:absolute;
   top:100%;
}

.nav ul ul li {
   float:none;
   border-top:2px solid OrangeRed;
   border-bottom:2px solid grey;
   position:relative;
}

.nav ul ul li a {
   padding:16px 41px;
   color:BlueViolet;
}

.nav ul ul li a:hover {
   background:Chartreuse;
}

.nav ul ul ul {
   position:absolute;
   left:100%;
   top:0;
}
</style> 
 </head> 
 <body> 
  <div class="nav"> 
   <ul> 
    <li> <a href="home.html">Lore</a> </li> 
    <li> <a href="#">Lorem</a> </li> 
    <li> <a href="#">Lorem ipsu</a> 
     <ul> 
      <li> <a href="#">Lorem</a> </li> 
      <li> <a href="#">Lorem</a> </li> 
      <li> <a href="#">Lorem</a> </li> 
      <li> <a href="#">Lorem</a> </li> 
      <li> <a href="#">Lorem</a> </li> 
      <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> 
    <li> <a href="#">Lorem ip</a> </li> 
    <li> <a href="#">Lorem i</a> </li> 
   </ul> 
  </div> 
  <!-- end of nav -->  
 </body>
</html>

Related Tutorials