I am trying to apply background color over the DIV element. Since the DIV's children are floating left, I assume both the children are in the DIV container.
But If I add position: absolute to DIV container, I could see the result as expected. But still, I don't understand it, what difference does it makes with absolute position.
<style>
span {
float: left;
padding: 10px;
}
div {
border: 1px solid #ccc;
background-color: yellow;
left: 200px;
}
</style>
<div>
<span>Span A</span>
<span>Span B</span>
</div>