Center two variable width columns - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:2 Column

Description

Center two variable width columns

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

.wrap {<!--from   ww  w .ja v a  2  s  .c o m-->
   text-align: center;
   border:1px solid grey;
   padding:1em;
}
.inner {
   display: inline-block;
}


      </style> 
 </head> 
 <body> 
  <div class="wrap" style="margin: 0 auto"> 
   <div class="inner" style="background: red; margin-right: 10px"> 
    <p>Lorem ipsum dolor sit amet.</p> 
   </div> 
   <div class="inner" style="background: red; "> 
    <p>Lorem sit amet, .</p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials