CSS - Floating sections left and right, responsive design - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Float

Description

CSS - Floating sections left and right, responsive design

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">
.wrapper {<!--from   w ww . j  a v  a2  s. c om-->
   width:401px;
}

.section {
   width:51%;
   min-height:201px;
}

.left {
   float:left;
   clear:left;
   background-color:Chartreuse;
}

.right {
   float:right;
   clear:right;
   background-color:yellow;
}
</style> 
 </head> 
 <body> 
  <div class="wrapper"> 
   <div class="section left">
     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, pharetr 
   </div> 
   <div class="section right">
     Lor 
   </div> 
   <div class="section left">
     Lor 
   </div> 
   <div class="section right">
     Lor 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials