Create 2 dynamic size divs and float:left - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Float

Description

Create 2 dynamic size divs and float:left

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">
#cont {<!--from   ww w.  ja va2  s. c  o  m-->
   width:301px;
}

.div1 {
   float:left;
   border:2px solid Chartreuse;
}

.div2 {
   float:left;
   border:2px solid yellow;
   max-width:251px;
}
</style> 
 </head> 
 <body> 
  <div id="cont"> 
   <div class="div1">
     text 1 
   </div> 
   <div class="div2">
     thats correct 
   </div> 
   <br> 
   <br> 
   <br> 
   <div class="div1">
     text 1 
   </div> 
   <div class="div2">
     this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test this is a test 
   </div> 
   <br style="clear:both;"> 
  </div>  
 </body>
</html>

Related Tutorials