How to Style a Sticky Page Footer with CSS

Make sure that all top and bottom margins of the footer inner elements are zero - or at least don't affect the whole footer bottom., Give the footer a position which is "Absolute"., Until now, the element was 'told' to stick in 'some place', but not...

6 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: Make sure that all top and bottom margins of the footer inner elements are zero - or at least don't affect the whole footer bottom.

    The recommended is zero, though. , Absolute position is telling the element to have a fixed place inside the page (not the screen) and it doesn't change whatever happens., So, we will add a bottom of zero, right of zero and left of zero.

    That will make the footer just stick to the bottom of the page., footer{position: absolute;bottom: 0;right:0;left:0;}
  2. Step 2: Give the footer a position which is "Absolute".

  3. Step 3: Until now

  4. Step 4: the element was 'told' to stick in 'some place'

  5. Step 5: but not where.

  6. Step 6: Check your code.

Detailed Guide

The recommended is zero, though. , Absolute position is telling the element to have a fixed place inside the page (not the screen) and it doesn't change whatever happens., So, we will add a bottom of zero, right of zero and left of zero.

That will make the footer just stick to the bottom of the page., footer{position: absolute;bottom: 0;right:0;left:0;}

About the Author

C

Cheryl Russell

Enthusiastic about teaching pet care techniques through clear, step-by-step guides.

53 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: