Content will push it down, but if there isn't enough content, it sticks to bottom
A Pen by Chris Coyier. Idea by Ryan Fait
<div class="page-wrap"> | |
<h1>Sticky Footer</h1> | |
<h2>with Fixed Footer Height</h2> | |
</div> | |
<footer class="site-footer"> | |
I'm the Sticky Footer. | |
</footer> |
/* Mostly: http://ryanfait.com/sticky-footer/ */ | |
* { | |
margin: 0; | |
} | |
html, body { | |
height: 100%; | |
} | |
.page-wrap { | |
min-height: 100%; | |
/* equal to footer height */ | |
margin-bottom: -142px; | |
} | |
.page-wrap:after { | |
content: ""; | |
display: block; | |
} | |
.site-footer, .page-wrap:after { | |
/* .push must be the same height as footer */ | |
height: 142px; | |
} | |
.site-footer { | |
background: orange; | |
} |