I am trying to prevent my footer from overlapping onto the elements above it when browser window height decreases. I realized that it is because the other div container
is not inheriting the height of inner divs, namely #cart
.
How can I make the outer div inherit height of the inner, non-floated divs?
Here is the page where its happening:
http://fine-grain-2.myshopify.com/cart
See the screenshot below for an illustration:
How I want it to be:
How it is currently when the browser window height gets too short.
HTML:
<div class="container">
<div id="cart" class="cart clearfix">
</div>
<footer class="clearfix">
<div class="additional-info"> Copyright © 2013 fine grain </div>
</footer>
CSS:
.container:after {
clear: both;
content: " ";
display: block;
height: 0;
visibility: hidden;
}
.container {
height: 100%;
margin: 0 auto;
padding: 0;
position: relative;
width: 960px;
}
.row:after, .clearfix:after {
clear: both;
}
.clearfix:before, .clearfix:after, .row:before, .row:after {
content: " ";
display: block;
height: 0;
overflow: hidden;
visibility: hidden;
width: 0;
}
.clearfix:before, .clearfix:after, .row:before, .row:after {
content: " ";
display: block;
height: 0;
overflow: hidden;
visibility: hidden;
width: 0;
}
#cart {
margin: 20px auto 0;
}
footer {
clear: both;
margin: 0 auto;
padding: 0 0 1em;
position: relative;
text-align: center;
}
.additional-info {
font-size: 0.8em;
}
@novicePrgrmr change container class like this
.container {
min-height: 100%;//min-height
margin: 0 auto;
padding: 0;
position: relative;
width: 960px;
}