CSS two columns with known children width - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:2 Column

Description

CSS two columns with known children width

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

.box {background:#20abff; color:#fff; width:100px; margin: 0 0 5px 0;}
.left {float:left;}
.right {float:right;}
.container {width:205px;}


      </style> 
 </head> <!--from  w w w. j  a va 2 s  . c  om-->
 <body> 
  <div class="container"> 
   <div class="left box-container"> 
    <div class="box" style="height:60px;">
      1 
    </div> 
    <div class="box" style="height:100px;">
      2 
    </div> 
    <div class="box" style="height:60px;">
      3 
    </div> 
   </div> 
   <!-- left-box-container --> 
   <div class="right box-container"> 
    <div class="box" style="height:30px;">
      1 
    </div> 
    <div class="box" style="height:200px;">
      2 
    </div> 
    <div class="box" style="height:60px;">
      3 
    </div> 
   </div> 
   <!-- right-box-container --> 
  </div>  
 </body>
</html>

Related Tutorials