I’m working on updating an old project I did in a course. We had to use handlebars for the project and the footer is giving me issues. If I don’t put a position on it, it will stay at the bottom of the page with longer content but it’s in the middle of the page for the rest of the pages with shorter content. If I put position: absolute and bottom: 0, the problem flips and it’s in the middle of the page on the longer content page but at the bottom on the shorter content pages.
I have min-height: 100vh on the body
Here is the footer.handlebars:
<footer class='footer footer-center p-5'>
<div class='grid grid-flow-col'>
<a class='link link-hover text about-us-footer' a href='/aboutus'>About Us</a>
</div>
<div>
<div class='grid grid-flow-col github'>
<a href='https://github.com/caitlinramsey/borrowhood-cr' target='_blank'><i class='fa fa- github' style='font-size:50px; color:black;'></i></a>
</div>
</div>
<div>
<p class='text copyright'>Copyright © 2023 - All right reserved by Borrowhood</p>
</div>
</footer>
Here is the current CSS though I’ve tried multiple things:
footer {
background-color: var(--secondary);
height: 250px;
position: absolute;
bottom: 0;
}
Any help is greatly appreciated!
I want the footer to be at the bottom of the page no matter the length of the page.
2
Answers
You can change your position to fixed so that it will be bottom at any page height and remove height if it not necessary so that there won’t be any extra space.
One should keep in mind, however, that websites aren’t pieces of paper, and shouldn’t really have footers. We have hyperlinks — just use those.