I am generally familiar with the technique of flushing a footer using css and this following approach.
But I am having some trouble getting this approach to work for Twitter bootstrap, most likely due to the fact that Twitter bootstrap is responsive in nature. Using Twitter bootstrap I am not able to get the footer to flush to the bottom of the page using the approach described in the above blog post.
The footer height matches the size of the bottom indent of the wrap element.
In the latest version of bootstrap 4-alpha, I was able to do it using
.fixed-bottom
class.Here's how I use it with the footer:
You can find more information in the placement documentation here.
another possible solution, just using media queries
A working example for Twitter bootstrap NOT STICKY FOOTER
You need at least an element with a
#footer
When not want the scrollbar if content would fit to screen just change the value of 10 to 0
The scrollbar will show up if content not fits to screen.
You need to wrap your
.container-fluid
div in order for your sticky footer to work, you're also missing some properties on your.wrapper
class. Try this:Remove the
padding-top:70px
from yourbody
tag and include it in your.container-fluid
instead, like so:We have to do this because pushing the
body
down to accommodate the navbar ends up pushing the footer a bit further (70px further) past the viewport so we get a scrollbar. We get better results pushing the.container-fluid
div instead.Next we have to remove the
.wrapper
class outside your.container-fluid
div and wrap your#main
div with it, like so:Your footer of course has to be out of the
.wrapper
div so remove it from the `.wrapper div and place it outside, like so:After thats all done, properly push your footer closer to your
.wrapper
class by using a negative margin, like so:And that should work, though you're probably going to have to modify a few other things to make it work when the screen is resized, like resetting the height on the
.wrapper
class, like so:Use the navbar component and add .navbar-fixed-bottom class:
add body