List with a scrollbar - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

List with a scrollbar

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <style>
body {<!--from  w w w  . jav  a 2 s  . c om-->
   font-family:sans-serif;
}

ul {
   background:gray;
   list-style:none;
   max-height:161px;
   overflow-y:scroll;
   padding:0 5px;
   display:inline-block;
}

li {
   color:Chartreuse;
   padding:5px 0;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li>Lorem ipsum dolor sit amet,</li> 
   <li>Lorem ipsum dolor sit amet, consectetur </li> 
   <li>Lorem ipsum dolor sit amet, consectetur adi</li> 
   <li>Lorem ipsum dolor sit amet, consectet</li> 
   <li>Lorem ipsum dolor sit amet, consectetur adipisc</li> 
   <li>Lorem ipsum dolor sit amet, cons</li> 
   <li>Lorem ipsum dolor sit amet, consect</li> 
   <li>Lorem ipsum dolor sit ame</li> 
   <li>Lorem ipsum dolor sit amet, consect</li> 
   <li>Lorem ipsum dolor sit amet, cons</li> 
  </ul>  
 </body>
</html>

Related Tutorials