How to Keep Your Footer at the Bottom of the Screen (or Below)
One of my pet peeves when it comes to front-end development is seeing a footer floating in the middle of the page. This usually happens because whoever built the page just placed the footer structurally below the main content and then I guess assumed there would be enough content to push the footer to the bottom of the page. Or maybe some other reason. Either way, the end result is that pages with very little content, or when viewed in a tall viewport, look kind of wonky.
Here are a couple (anonymized) examples:
These are just from the last few days. I see these all the time, and sometimes on fairly major sites. š¢
If either of the above (or countless others I see regularly) were a website I was working on, especially if I were the front-end dev who built this page, Iād be pretty embarassed.
Yes, itās a small thing. But itās a small thing sort of like forgetting to zip your fly is a small thing. š³ Itās not a good look and kind of hard to ignore once you notice it.
But the good news is itās easy to fix.
This is probably one of the simplest ways to keep your footer at the bottom of your viewport or below it:
This will work nicely on most browsers, and if viewed on a very old browser (eg IE 10), it will just āgracefully degradeā to the old floating footer.