Dropdown menu with background - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Menu Dropdown

Description

Dropdown menu with background

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style>
.parent {<!--from  ww  w  .  ja  va2  s  .  c o  m-->
   background-color:Chartreuse;
   width:501px;
}

.dropbtn {
   background-color:yellow;
   color:blue;
   padding:17px;
   font-size:17px;
   border:none;
}

.dropdown {
   position:relative;
   display:inline-block;
}

.dropdown-content {
   display:none;
   position:absolute;
   background-color:pink;
   min-width:161px;
   box-shadow:0px 9px 17px 0px OrangeRed;
   z-index:2;
}

.dropdown-content a:hover {
   background-color:grey;
}

.dropdown:hover .dropdown-content {
   display:block;
}

.dropdown:hover .dropbtn {
   background-color:BlueViolet;
}
</style> 
 </head> 
 <body> 
  <h2>Lorem ipsum dolor </h2> 
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p> 
  <div class="parent"> 
   <div class="dropdown"> 
    <button class="dropbtn">Lorem</button> 
    <div class="dropdown-content"> 
     <p>Lorem </p> 
     <p>Lorem </p> 
     <p>Lorem </p> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials