wrap table cell at a maximum width in full width table - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Cell

Description

wrap table cell at a maximum width in full width 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">
table {<!--from w  w w .j  a v  a  2 s.  com-->
   width:100%;
}

th {
   text-align:right;
   width:11px;
   max-width:301px;
   white-space:nowrap;
   word-break:break-all;
   text-overflow:ellipsis;
   overflow:hidden;
}
</style> 
 </head> 
 <body> 
  <table border="1"> 
   <tbody> 
    <tr> 
     <th>Lorem ipsum </th> 
     <td>Lorem</td> 
    </tr> 
   </tbody> 
  </table> 
  <br> 
  <table border="1"> 
   <tbody> 
    <tr> 
     <th>Lorem ipsum </th> 
     <td>Lorem</td> 
    </tr> 
    <tr> 
     <th>Lorem ipsum dolor</th> 
     <td>Lorem</td> 
    </tr> 
   </tbody> 
  </table> 
  <br> 
  <table border="1"> 
   <tbody> 
    <tr> 
     <th>Lorem ipsum </th> 
     <td>Lorem</td> 
    </tr> 
    <tr> 
     <th>Lorem ipsum dolor</th> 
     <td>Lorem</td> 
    </tr> 
    <tr> 
     <th>Lorem ipsum dolor sit amet, consectetur</th> 
     <td>Lorem</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials