floating elements (two header sections, a container, and a footer), and I'm trying to put the footer below the container. Everything inside the container is floated and overflows, so the container itself is of height zero and the footer shows up underneath some of my content, like this (it's the lower red bar):
How can I make the container the same height as the content it contains without making it fixed height or floating the container?
Here's the body of the index.html:
<body>
<div class="headerBar">
</div>
<div class="tabArea">
</div>
<div class="container">
<div id="featureBar">
<div class="feature"></div>
<div class="feature"></div>
<div class="feature last"></div>
</div>
<div class="contentBox" id="medHeight">
ef
</div>
<div class="contentBox" id="largeHeight">
ef
</div>
</div>
<footer>
footer
</footer>
</body>
And here's the stylesheet:
/**
* ========== HEADER ==========
*/
.headerBar {
margin: 30px -10px 0 -10px;
height: 100px;
background: black;
}
.tabArea {
margin: 0 -10px 0 -10px;
height: 100px;
background: red;
}
/**
* ========== HOME PAGE ==========
*/
#featureBar {
margin-top: 50px;
}
.feature {
width: 310px;
height: 265px;
margin-right: 10px;
background: green;
float: left;
}
.contentBox {
margin-top: 60px;
width: 100%;
background: purple;
float: left;
}
#medHeight {height: 270px;}
#largeHeight {height: 540px;}
.last{margin-right: 0;}
/**
* ========== FOOTER ==========
*/
footer {
margin: 60px -10px 0 -10px;
height: 120px;
background: red;
}