Skip to content

Instantly share code, notes, and snippets.

@nacholibre
Created January 5, 2015 13:27
Show Gist options
  • Save nacholibre/3918dfab7db52543f5be to your computer and use it in GitHub Desktop.
Save nacholibre/3918dfab7db52543f5be to your computer and use it in GitHub Desktop.
Sticky footer
<style>
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;
}
</style>
<div class="page-wrap">
<h1>Sticky Footer</h1>
<h2>with Fixed Footer Height</h2>
<button id="add">Add Content</button>
</div>
<footer class="site-footer">
I'm the Sticky Footer.
</footer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment