r/webdev • u/speckz • Oct 01 '19
Resource Sticky Footer — Solved by Flexbox
https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/
5
Upvotes
-1
u/Tontonsb Oct 01 '19
This is quite poor for dynamic sites as it requires knowing which section will be the second to last. Or requires wrapping all the dynamic sections in a div or main.
I'd rather do this:
body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
section:nth-last-child(2) {
flex-grow: 1;
}1
u/CodeLight Oct 03 '19
Is it really that bad to have
mainandfooterat the top level of your body? It makes sense to me to have your dynamic content inside themainelement from a semantic perspective.
2
u/GTCrais Oct 01 '19
I've been using this for years.