Fixed footer in Bootstrap
Solution 1:
To get a footer that sticks to the bottom of your viewport, give it a fixed position like this:
footer {
position: fixed;
height: 100px;
bottom: 0;
width: 100%;
}
Bootstrap includes this CSS in the Navbar > Placement section with the class fixed-bottom
. Just add this class to your footer element:
<footer class="fixed-bottom">
Bootstrap docs: https://getbootstrap.com/docs/4.4/utilities/position/#fixed-bottom
Solution 2:
Add this:
<div class="footer navbar-fixed-bottom">
https://stackoverflow.com/a/21604189
EDIT: class navbar-fixed-bottom
has been changed to fixed-bottom
as of Bootstrap v4-alpha.6.
http://v4-alpha.getbootstrap.com/components/navbar/#placement
Solution 3:
Add fixed-bottom:
<div class="footer fixed-bottom">
Solution 4:
Add z-index:-9999;
to this method, or it will cover your top bar if you have 1
.