Layout 2 different divs start from the same point, align to left and right - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:2 Column

Description

Layout 2 different divs start from the same point, align to left and right

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">
.part1, .part2 {<!--from  w  w  w  .j  av  a  2 s.c  o  m-->
   position:relative;
   clear:both;
}

#p1left, #p2left {
   float:left;
}

#p1right,#p2right {
   float:right;
}
</style> 
 </head> 
 <body> 
  <div class="part1"> 
   <div id="p1left">
     something 
   </div> 
   <div id="p1right">
     something 
   </div> 
  </div> 
  <div class="part2"> 
   <div id="p2left">
     something 
   </div> 
   <div id="p2right">
     something 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials