Many people have asked about creating a sticky footer and main containers with 100% min-height. But how can I achieve this for multiple sections, ensuring each one has a 100% min-height while still pushing the footer below?
Currently, my sections are set to 100%, but the footer remains at the top.
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>test</title>
<style type="text/css" media="all">
html, body, .main-container{height:100%;}
section{min-height: 100%;}
.footer-container{height: 100px;}
</style>
</head>
<body>
<div class="header-container">
<header>
header
</header>
</div>
<div class="main-container">
<section>
section
</section>
<section>
section2
</section>
<section>
section3
</section>
</div>
<div class="footer-container">
<footer>
footer
</footer>
</div>
</body>
</html>
Check out the corresponding jsFiddle here: http://jsfiddle.net/S7h8s/