Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a non-sticky footer in Bootstrap?

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.

like image 600
NSaid Avatar asked Jul 15 '13 20:07

NSaid


People also ask

How do I create a footer in bootstrap?

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.

How do I stick the footer to the bottom of bootstrap 5?

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.


1 Answers

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%;
}
like image 68
Joris Kok Avatar answered Oct 06 '22 19:10

Joris Kok