Vertically Center Two Side-By-Side Text Columns of Different Heights - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:2 Column

Description

Vertically Center Two Side-By-Side Text Columns of Different Heights

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">

html,<!--from  w w w  .j a v a  2  s. com-->
body {
   min-height: 100%;
   height: 100%;
   margin: 0;
   padding: 0;
}

.containbox {
   display: table;
   width: 100%;
   height: 100%;
}

.leftbox,
.rightbox {
   width: 50%;
   display: table-cell;
   vertical-align: middle;
   width: 50%;
   text-align: center;
   padding: 2%;
}

.rightbox {
   border-left: 1px solid blue;
}

      </style> 
 </head> 
 <body> 
  <div class="containbox"> 
   <div class="leftbox">
     Some Text Long 
   </div> 
   <div class="rightbox">
     Some other long text 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials