Button with dropdown menu - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Button with dropdown menu

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">
.navbar {<!-- w  w w.  j ava2s .c  om-->
   font-size:21px;
   text-align:center;
   position:relative;
   z-index:2;
   white-space:nowrap;
}

.navbar a {
   background-color:Chartreuse;
   color:yellow;
   text-decoration:none;
}

.navbar ul {
   padding:0;
   margin:0px;
   list-style:none;
}

.navbar li {
   float:left;
   position:relative;
   min-width:121px;
   margin:0px 13px;
   padding:11px 11px 11px 11px;
   background-color:blue;
   color:pink;
}

.navbar li ul {
   display:none;
   position:absolute;
   top:43px;
   left:-13px;
}

.navbar li ul li {
   display:block;
   width:100%;
   text-align:left;
}

.navbar li:hover,
.navbar li:hover>a,
.navbar li a:hover {
   background-color:OrangeRed;
   color:grey;
   text-decoration:none;
   display:block;
}

.navbar li:hover ul,
.navbar li:hover ul li {
   display:block;
   clear:both;
   min-width:121px;
}
</style> 
 </head> 
 <body> 
  <nav class="navbar"> 
   <ul> 
    <li> <a href="#">Lore</a> </li> 
    <li> <a href="#">Lorem ipsum d</a> 
     <ul> 
      <li> <a href="#">Lorem ipsu</a> </li> 
      <li> <a href="#">Lorem ipsum dolor sit amet</a> </li> 
      <li> <a href="#">Lorem ipsu</a> </li> 
     </ul> </li> 
   </ul> 
  </nav>  
 </body>
</html>

Related Tutorials