I have the following code:
<div "background-color:green">
<div "float:left">something</div>
<div "float:right:>something else</div>
<div>
Why does the background color not appear in this case? What needs to be done to make it appear
{Code simplified for understanding , may not be in the approporiate syntax}
You need to clear the div. You can use
clear: bothon an element beneath, but I often find this is easier:Notice the overflow: hidden.
Of course, it only works where you don’t require elements to leave their containing elements.