Using display: table-cell to create two column layout - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Cell

Description

Using display: table-cell to create two column layout

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,body {
   width:100%;
   margin:0
}

.col {<!--from  w  w  w.  j a  v  a  2 s.co  m-->
   width:967px;
   display:table;
}

.ttl {
   width:572px;
   background:red;
}

.otr {
   width:255px;
   background:blue;
}

.ttl, .otr {
   margin-left:21px;
   padding:21px;
   display:table-cell;
}
</style> 
 </head> 
 <body> 
  <div class="col"> 
   <div class="ttl"> 
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in, pharetra nisl. Maecenas aliquam luctus mauris, vitae venenatis diam imperdiet vel. Donec tortor diam, pretium vitae nibh vitae, consec</p> 
   </div> 
   <div class="otr"> 
    <p>Lorem ip</p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials