get overflow:auto behavior with HTML table - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table

Description

get overflow:auto behavior with HTML table

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">
#wrapper {<!--   w  w w. j  av  a 2 s  .c o  m-->
   width:251px;
}

table {
   display:block;
   overflow:scroll;
   border-collapse:collapse;
   width:100%;
}

td {
   border:2px solid Chartreuse;
   padding:4px;
   box-sizing:border-box;
   border-collapse:collapse;
}

td:nth-child(1) {
   min-width:41px;
}

td:nth-child(2) {
   min-width:41px;
}

td:nth-child(3) {
   min-width:170px;
}
</style> 
 </head> 
 <body> 
  <div id="wrapper"> 
   <p>Lorem ipsum dolor sit amet, consectetur</p> 
   <table> 
    <thead> 
     <tr> 
      <td>L</td> 
      <td>L</td> 
      <td>L</td> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td>Lo</td> 
      <td>Lo</td> 
      <td>Lorem ipsum d</td> 
     </tr> 
     <tr> 
      <td>Lo</td> 
      <td>Lo</td> 
      <td>Lo</td> 
     </tr> 
    </tbody> 
   </table> 
  </div>  
 </body>
</html>

Related Tutorials