Layout 2 DIVs aligned right and left with background color - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:2 Column

Description

Layout 2 DIVs aligned right and left with background color

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%;
   height:100%;
   margin:0;
   padding:0;
}

.mainDiv {<!--  w w w  .  jav a2  s  .  co m-->
   width:100%;
}

.left-edge {
   float:left;
   width:51%;
   height:201px;
   background-color:Chartreuse;
}

.right-edge {
   float:left;
   width:51%;
   height:201px;
   background-color:yellow;
   text-align:right;
}
</style> 
 </head> 
 <body> 
  <div class="mainDiv"> 
   <div class="left-edge">
     hi 
   </div> 
   <div class="right-edge">
     right side! 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials