Use width:100% to make a table expand relative to window size - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Width

Description

Use width:100% to make a table expand relative to window size

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 ww  w  .j  a v a2  s  .  com-->
   display:table;
   margin-right:auto;
   margin-left:auto;
   width:100%;
}

.tablecell {
   display:table-cell;
   text-align:center;
}
</style> 
 </head> 
 <body> 
  <div class="table"> 
   <div class="tablecell"> 
    <img src="https://www.java2s.com/style/demo/Opera.png"> 
   </div> 
   <div class="tablecell"> 
    <img src="https://www.java2s.com/style/demo/Safari.png"> 
   </div> 
   <div class="tablecell"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
   </div> 
   <div class="tablecell"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
   </div> 
   <div class="tablecell"> 
    <img src="https://www.java2s.com/style/demo/Firefox.png"> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials