If a Div contains floating divs it will not resize the height to contain the floating divs. So adding padding to the containg div has no effect. This is how floating divs are supposed to behave. IE ignores this and contains them anyway, but most other modern browsers follow the rules and let the inner divs float 'uncontained'.
The simple solution to this problem is to include and empty div after the floating divs and within the container. This empty div must not have a floating property and must be set to clear the floating divs. This gives the container div something to wrap around. The code will look something like this:
<div class="container">
<div class="float-left"> </div>
<div class="float-right"> </div>
<div style="clear:both;"> </div>
</div>
So the magic bit is
"<div style="clear:both;"> </div>" just insert it just before you close the container div.
Thanks a lot for that.
ReplyDeleteMy first search on the subject and I got the answer.
I've been meaning to read this and just never got a chance. Its an issue that Im really interested in. I just started reading and Im glad I did. Youre a fantastic blogger and I can't wait to see what you come up with next!
ReplyDelete