Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap footer not at bottom

I am attempting to enforce that my footer goes at the bottom of my website. I do not want it to stick when I scroll, just to appear at the bottom when scrolling down the webpage.

Currently - the webpage displays with the footer sitting beneath the content. I have added such code as bottom:0; and found that it sticks and does not suit my website. I have also added such code as html, body { height:100%;} as viewed on other stackoverflow questions - but have had no joy.

Any advice would be appreciated.

Code:

    .footer {
    	background: #F37A1D;
       	position : absolute;
    	width: 100%;
    	border-top: 3px solid #F37A1D;
    }
    <div class="footer">
    <div class="container">
            <p>&copy; COMPAY 2015</p>
        </div>
    </div>
like image 752
user289040 Avatar asked May 12 '15 18:05

user289040


2 Answers

*{
    padding: 0;
    margin: 0;
}

html {
  position: relative;
  min-height: 100%;
}
body {
  /* Margin bottom by footer height */
  margin-bottom: 60px;
}
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  /* Set the fixed height of the footer here */
  height: 60px;
  background: #F37A1D;
 border-top: 3px solid #F37A1D;   
}
<div class="footer">
    <div class="container">
            <p>&copy; COMPAY 2015</p>
        </div>
    </div>
like image 77
Dmitriy Avatar answered Oct 19 '22 09:10

Dmitriy


You can just add navbar-fixed-bottom class to the footer.

<footer class="navbar-fixed-bottom">
    <p>Footer content</p>
</footer>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
  <div class="jumbotron">
    <h1>Twitter Bootstrap 3.0</h1>
  </div>

  <footer class="navbar-fixed-bottom">
    <p>Footer content</p>
  </footer>

</div>

You may also want to refer to Bootstrap sticky footer CSS.

like image 23
rageit Avatar answered Oct 19 '22 09:10

rageit