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...
Step-by-Step Guide
-
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;} -
Step 2: Give the footer a position which is "Absolute".
-
Step 3: Until now
-
Step 4: the element was 'told' to stick in 'some place'
-
Step 5: but not where.
-
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
Cheryl Russell
Enthusiastic about teaching pet care techniques through clear, step-by-step guides.
Rate This Guide
How helpful was this guide? Click to rate: