set tbody height with overflow scroll - HTML CSS CSS Property

HTML CSS examples for CSS Property:overflow

Description

set tbody height with overflow scroll

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">
tr td {
   border:2px solid Chartreuse;
}
</style> <!--   w  ww  .  j a va2  s . c  o m-->
 </head> 
 <body> 
  <h3>Lorem i</h3> 
  <table style="border: 1px solid red;width:300px"> 
   <thead> 
    <tr> 
     <td>Lore</td> 
     <td>Lorem</td>Lor 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td>Lore</td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem</td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem</td> 
     <td>Lorem i</td> 
    </tr> 
   </tbody> 
  </table> 
  <hr> 
  <h3>Lorem i</h3> 
  <table style="border: 1px solid red;width:300px;display:block;"> 
   <thead> 
    <tr> 
     <td width="150">Lore</td> 
     <td width="150">Lorem</td> 
    </tr> 
   </thead> 
   <tbody style="height:50px;overflow:auto;display:block;width:317px;"> 
    <tr> 
     <td width="150">Lore</td> 
     <td width="150">Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem</td> 
     <td>Lorem </td> 
    </tr> 
    <tr> 
     <td>Lorem</td> 
     <td>Lorem i</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials