If you have two divs contained within a div:
<div style="border:1px;">
<div style="float:left;background-color:red;width:20px;height:20px;">
<div style="float:left;background-color:red;width:20px;height:20px;">
</div>
The two inner divs are rendered as 'invisible', as in the container div doesn't stretch to allow them to fill, as if they were not there. This creates ugly overlaps/whitespace etc.
How do you go about resolving this issue?
Insert the third div:
<div style="clear:both;"></div>
I think it may be because you are forgetting to close the tags, try this:
<div style="border:1px;">
<div style="float:left;background-color:red;width:20px;height:20px;"></div>
<div style="float:left;background-color:green;width:20px;height:20px;"></div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With