Last active
August 29, 2015 14:22
-
-
Save yratof/ed5def5c43ce48666a43 to your computer and use it in GitHub Desktop.
Sticky Footer using Flexbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<div class="content"> | |
<!-- Any amount of content here --> | |
</div> | |
<footer> | |
<!-- This will always be in the footer now. --> | |
</footer> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 ============== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remember to run this through autoprefixer!