Create dropdown list with scrollbar - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

Create dropdown list with scrollbar

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <style type="text/css">
.dropbtn {<!--from w ww  .  j a  v  a 2  s .  c om-->
   background-color:Chartreuse;
   color:yellow;
   padding:17px;
   font-size:17px;
   border:none;
   cursor:pointer;
}

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

.dropdown-content {
   display:none;
   position:absolute;
   background-color:blue;
   min-width:161px;
   max-height:201px;
   overflow:auto;
   box-shadow:0px 9px 17px 0px pink;
}

.dropdown-content a {
   color:OrangeRed;
   padding:13px 17px;
   text-decoration:none;
   display:block;
}

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

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

.dropdown:hover .dropbtn {
   background-color:BlueViolet;
}
</style> 
 </head> 
 <body> 
  <div class="dropdown"> 
   <button class="dropbtn">Lorem ip</button> 
   <div class="dropdown-content"> 
    <a href="#">Lorem ip</a> 
    <a href="#">Lorem ip</a> 
    <a href="#">Lorem ip</a> 
    <a href="#">Lorem ip</a> 
    <a href="#">Lorem ip</a> 
    <a href="#">Lorem ip</a> 
    <a href="#">Lorem ip</a> 
    <a href="#">Lorem ip</a> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials