Same width and height column by display:table - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Column Layout

Description

Same width and height column by display: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">

body {<!--from ww w  . j  av  a2 s .  c  om-->
   margin: 10px;
   padding: 0;
}
.table {
   display: table;
   border-collapse: collapse;
   height: 100%;
}
.cell {
   display: table-cell;
   width: calc(((100vw - 17px - 20px) / 4) - 20px);
   padding: 0 10px;
   height: 100%;
}
.white-box {
   border: solid 1px #ccc;
   background: #eee;
   height: 100%;
}


      </style> 
 </head> 
 <body> 
  <div class="table"> 
   <div class="cell"> 
    <div class="white-box">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. 
    </div> 
   </div> 
   <div class="cell"> 
    <div class="white-box">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
    </div> 
   </div> 
   <div class="cell"> 
    <div class="white-box">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
    </div> 
   </div> 
   <div class="cell"> 
    <div class="white-box">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
    </div> 
   </div> 
  </div> 
  <br> 
  <div class="table"> 
   <div class="cell"> 
    <div class="white-box">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. 
    </div> 
   </div> 
   <div class="cell"> 
    <div class="white-box">
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials