Skip to content

Instantly share code, notes, and snippets.

@michaelschofield
Created August 19, 2013 20:49
Show Gist options
  • Save michaelschofield/6274020 to your computer and use it in GitHub Desktop.
Save michaelschofield/6274020 to your computer and use it in GitHub Desktop.
Sticky Footer
html, body { height: 100%; }
#container {
min-height: 100%;
margin-bottom: -12em; // Arbitrary. Must be the same as footer height.
&:after {
content: "";
display: block;
}
}
.footer, #container:after {
height: 12em;
}
/*
I couldn't get this work, at first.
The thing is that you must wrap *all* content
except the footer in a container. I had originally
broken my HTML out into <header>, <div id="content">, and <footer>.
Applying the above just to #content doesn't work. Instead, it
requires the following structure:
<div id="container">
<header></header>
<div id="content"></div>
</div> <!--/#container-->
<footer></footer>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment