Footer that stays at the bottom

Short pages still push the footer to the bottom of the window.

CSS · Footer that stays at the bottomBeginner
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main   { flex: 1; }
footer { padding: 1rem; background: #111827; color: #d1d5db; }
footerflexboxmin-heightlayout