justask.dev

Community powered answers to your dev questions

Sticky footer

posted: 2019 December 6th

category: css

Edit this post on GitHub.

Back

There are many ways to make a footer stick to the bottom of a page. The best way, in my opinion uses flexbox

1html,
2 body {
3 height: 100%;
4 }
5
6 body {
7 display: flex;
8 flex-direction: column;
9 }
10
11 .content {
12 flex: 1 0 auto;
13 }
14
15 .footer {
16 flex-shrink: 0;
17 }

Author: Rich Haines