Creating a Sticky Footer
A "sticky" footer is a footer that remains glued to the bottom of the browser window at all times, no matter how far up or down the page the user scrolls. You can achieve this easily using the CSS position property.
This layout technique is perfect for persistent app-like navigation bars, chat widgets, or constant "sign up" banners.
Using Position Sticky
To make an element sticky, you simply grant it position: sticky. However, a position of sticky won't do anything by itself. You also have to tell the browser where you want it to stick.
Because we want a sticky footer, we tell it to stick to the bottom of the screen, specifically at exactly 0 pixels away from the edge:
Tip: position: fixed vs position: sticky
While position: fixed will permanently glue the footer to the bottom of the screen from the moment the page loads, position: sticky allows the footer to behave like a normal element inside the document until the scrolling viewport actually collides with it. At that point of contact, it "sticks" to the window.
Full Working Example
Below is a demonstration of a sticky footer. A large height has been applied to the content area so that the page is scrollable. Try scrolling down through the preview pane and watch how the footer remains permanently anchored to the bottom: