HTML/CSSIntermediate#css#layout-puzzle#flexbox

How do you build a sticky footer that stays at the bottom even with little content?

Make the body a flex column with min-height: 100vh, let the main content area grow with flex: 1, and the footer naturally sits at the bottom whether content is short or long.

Example
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; }
footer { flex-shrink: 0; }

Related Questions

1
HTML/CSSBeginner#css#grid

Explain CSS Grid: grid-template-columns/rows and fr unit.

Open
2
HTML/CSSAdvanced#css#grid

How do you create a responsive grid without media queries using auto-fit/auto-fill?

Open
3
HTML/CSSIntermediate#css#grid

What is the difference between Flexbox and Grid, and when should you use each?

Open