You need to clear the floats. When all of the child elements are floating, the parent is not aware of their height, and so collapses. Putting something like a clearfix on the parent should fix the problem. See http://nicolasgallagher.com/micro-clearfix-hack/ for details on the clearfix.
See http://jsfiddle.net/designingsean/Ec95D/4/ for a working example. CSS from the link is below. Then just add .cf
to the parent element.
.cf:before,
.cf:after {
content: " ";
display: table;
}
.cf:after {
clear: both;
}
You could also make the parent have an overflow
set to pretty much anything, though auto
makes the most sense in most cases. See http://jsfiddle.net/designingsean/cx7Wg/ for a working example of that.
For more on clearfix vs overflow, check out this pretty solid SO question and answer: What methods of ‘clearfix’ can I use?