Forum Moderators: not2easy
Thank you very much.
First of all, I always make sure may containing div has a specified width.
Then I have 2 divs inside the container, One float:right, one float:left and I always make sure to specify their widths as well. After those two divs I have a div which has no purpose other than clearing the floats. It works great, but that clearing div has always annoyed me.
The end result looks like the following:
css:
#container{width:500px;}
.left{width:200px;float:left;}
.right{width:200px;float:right;}
.clear{clear:both;}
html:
<div id="container">
<div class="left"><img src="lalala.jpg" alt="" /><p>text text</p></div>
<div class="right">text text text text</div>
<div class="clear"></div>
</div>
The end result looks like the following:
css:
#container{width:500px;}
.left{ clear:both; width:200px;float:left;}
.right{ width:200px;float:right;}
html:
<div id="container">
<div class="left"><img src="lalala.jpg" alt="" /><p>text text</p></div>
<div class="right">text text text text</div>
</div>