I'm building a web application in PHP. I want to include a footer which is sticky. I use include 'footer.php';
and it works perfect on all the pages except one page. On this page it sticks to the middle of the page with content under it. If I delete bottom: 0
it fixes it on this page but it's messed up on other pages.
CSS
#footer {
background: #f7f7f7;
position: absolute;
border-top: 1px solid #dedede;
height: 70px;
width: 100%;
bottom: 0;
left: 0;
overflow: hidden;
}
#footer li{
padding-right: 20px;
display: inline;
}
HTML
<!--Footer-->
<div id="footer">
<span class="copyright">© 2016 Gym</span>
<ul class="social">
<li><a href="#">About</a></li>
<li><a href="#">Terms</a></li>
<li><a href="#">Privacy</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Blog</a></li>
</ul>
<div style="clear: both"></div>
</div>
I think you render footer where parent
is relative.
You can also use position:fixed
for sticky bottom of all pages.