Display: box with box-align stretch and center at the same time - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Box

Description

Display: box with box-align stretch and center at the same time

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 {<!--   ww  w.  j  a va2 s. c o m-->
   display:table;
   width:100%;
}

.cell {
   display:table-cell;
   vertical-align:middle;
   width:34.34%;
}

#cell1 {
   background-color:Chartreuse;
}

#cell2 {
   background-color:yellow;
}

#cell3 {
   background-color:blue;
}
</style> 
 </head> 
 <body> 
  <div class="table"> 
   <div class="cell" id="cell1">
     Lorem 
   </div> 
   <div class="cell" id="cell2">
     Lorem ipsum dolo 
   </div> 
   <div class="cell" id="cell3">
     Lorem i 
    <br>Lore 
    <br>Lorem 
    <br>Lorem 
    <br>Lorem 
    <br>Lorem 
    <br>Lorem 
    <br>Lorem ip 
    <br>Lorem 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials