how to make a div to wrap two float divs inside?
Solution 1:
Aside from the clear: both
hack, you can skip the extra element and use overflow: hidden
on the wrapping div
:
<div style="overflow: hidden;">
<div style="float: left;"></div>
<div style="float: left;"></div>
</div>
Solution 2:
It's a common problem when you have two floats inside a block. The best way of fixing it is using clear:both
after the second div
.
<div style="display: block; clear: both;"></div>
It should force the container to be the correct height.