Background color is usually treated as transparent
, not inherit
, by default. With inherit
, the background image would be copied to each element and displaced by margins/paddings/etc (has a more obvious effect with background images).
Normally, this wouldn't matter, since the parent would usually become large enough to contain all of the children (so they would show through the parent's background). But, since you're using float
on all children, the actual size of #content
is not actually the size of the child divs combined.
Floating content can exist outside the bounds of its parent.
Without any static content of its own, #content
has a height of 0, while content_left/right/middle
actually exist below it (since they have ...
for content, their height defaults to line-height
).
To get a better view of what's happening, try adding a height to #content
and background color to the children (or use "Inspect Element" and tag highlighting in Chrome or Firebug):
#content { background-color: #FFF; height: 5px; }
#content_right(middle/left) { float: left; width: 500px; background: #ccc; }
But, yes, you need to specify the background color in the floating divs rather than their parent.