How do I produce a footer that spans the whole width of the screen (despite screen resolution) and stays at the bottom of the page?
When I search for this I get people providing code for sticky footers (footers that hoover with the page), and saying use absolute positioning (which I hear is a no no).
A perfect example of what I mean is the one of the sites twitter bootstrap cites as an example (https://www.gathercontent.com/). On that site the footer (which looks like a hero unit or something) is always on the bottom of the page.
You can simply add Footer to your Bootstrap project by using these predefined templates. Choose the template you like and add this at the bottom of your project. If you want to learn more about the construction of the Foter and get to know the basic and advanced usage of this component - read the Footer Docs.
To make your footer stick to the bottom of the viewport, add classes d-flex , flex-column , and h-100 to the body tag. Also add class h-100 to <html> tag.
If you are using bootstrap, this example shows how you can do it. The name is misleading on the site, but it stays at the bottom of the page if there isn't much content. It also moves down the page if there is a lot of content (so doesn't stick).
The footer:
http://getbootstrap.com/docs/4.0/examples/sticky-footer-navbar/
The CSS:
http://getbootstrap.com/docs/4.0/examples/sticky-footer-navbar/sticky-footer-navbar.css
Make sure not to forget the
html {
position: relative;
min-height: 100%;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With