Table inside a div with max-height - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div Table

Description

Table inside a div with max-height

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
 </head> <!--from w  w w .j  ava 2 s . co m-->
 <body> 
  <style type="text/css">
.a {
   max-height:100px;
   overflow:auto;
   border:2px solid Chartreuse;
   display:inline-block;
   margin-right:11px;
}

.b {
   width:100%;
   margin-right:21px;
}

td {
   border-bottom:2px solid yellow;
}
</style> 
  <div class="a"> 
   <div class="b"> 
    <table> 
     <tbody> 
      <tr> 
       <td>Lorem ipsum dolor s</td> 
      </tr> 
      <tr> 
       <td>Lorem ipsum dolor s</td> 
      </tr> 
      <tr> 
       <td>Lorem ipsum dolor s</td> 
      </tr> 
      <tr> 
       <td>Lorem ipsum dolor s</td> 
      </tr> 
      <tr> 
       <td>Lorem ipsum dolor s</td> 
      </tr> 
      <tr> 
       <td>Lorem ipsum dolor s</td> 
      </tr> 
      <tr> 
       <td>Lorem ipsum dolor s</td> 
      </tr> 
     </tbody> 
    </table> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials