Skip to content

Instantly share code, notes, and snippets.

@yratof
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save yratof/ed5def5c43ce48666a43 to your computer and use it in GitHub Desktop.

Select an option

Save yratof/ed5def5c43ce48666a43 to your computer and use it in GitHub Desktop.
Sticky Footer using Flexbox
<div class="container">
<div class="content">
<!-- Any amount of content here -->
</div>
<footer>
<!-- This will always be in the footer now. -->
</footer>
</div>
// Sticky Footer ==============
#container{
display: flex;
min-height: 100%;
min-height: 100vh;
flex-direction: column;
}
.header, .sidebar,
.footer, .fnav{
flex-shrink: 0; // Hack to stop height messing up
}
#content{
flex: 1 0 auto; // Avoid min height bug
}
// Sticky Footer ==============
@yratof

yratof commented Jun 3, 2015

Copy link
Copy Markdown
Author

Remember to run this through autoprefixer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment