Properly overflow with a static height - HTML CSS CSS Property

HTML CSS examples for CSS Property:overflow

Description

Properly overflow with a static height

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.container {<!--   w w  w .  j ava 2s  . co m-->
   height:201px;
   width:401px;
}

#ex1, #ex2 {
   float:left;
   height:100%;
   width:46%;
   border:2px solid Chartreuse;
   overflow:auto;
}

#ex2 {
   overflow:y-scroll;
}

.scroll-container {
   overflow:auto;
}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <div id="ex1"> 
    <span>Lorem ipsum</span> 
    <ul> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
     <li>Lorem i</li> 
    </ul> 
   </div> 
   <div id="ex2"> 
    <span>Lorem ipsum</span> 
    <div class="scroll-container"> 
     <ul> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
      <li>Lorem i</li> 
     </ul> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials