Make 100% width table overflowing inside a narrow div container - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div Table

Description

Make 100% width table overflowing inside a narrow div container

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">
.page {<!-- w w  w  . ja  v a2  s  .c  om-->
   width:281px;
   border:2px solid Chartreuse;
}

.my-table {
   word-wrap:break-word;
   table-layout:fixed;
   width:100%;
}

.my-table td {
   border:2px solid yellow;
}
</style> 
 </head> 
 <body> 
  <div class="page"> 
   <table class="my-table"> 
    <tbody> 
     <tr> 
      <th>Header Text</th> 
      <th>Col 1</th> 
      <th>Col 2</th> 
      <th>Col 3</th> 
      <th>Col 4</th> 
      <th>Header Text</th> 
     </tr> 
     <tr> 
      <td>this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. </td> 
      <td>some data</td> 
      <td>some data</td> 
      <td>some data</td> 
      <td>some data</td> 
      <td>this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. </td> 
     </tr> 
    </tbody> 
   </table> 
  </div>  
 </body>
</html>

Related Tutorials