show the scroll bar of a div in a table using percentage height - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div Table

Description

show the scroll bar of a div in a table using percentage 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">
.scroll {<!-- w  w w .  j  av a 2s.  c om-->
   height:31%;
   overflow:auto;
   width:100%;
   display:block;
}
</style> 
 </head> 
 <body> 
  <div></div> 
  <table border="1"> 
   <tbody class="scroll" style="
    width: 194px;
    height: 162px;"> 
    <tr> 
     <td>Lorem i</td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem ipsum do</td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem ipsum dolor</td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem i</td> 
     <td>Lorem i</td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
     <td>Lorem i</td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
     <td>Lorem i</td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
     <td>Lorem i</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials