Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Need help keeping footer at the bottom of the page.

I want my footer to be at the bottom of the page but for some of my pages it goes into the middle of the page and cuts into the content. The only fix I could find is turning it into a sticky footer by making position: relative to position: fixed but I don't really like the look of the sticky footer. I only want it to be seen if you scroll down all the way to the bottom of the page

HTML: <div class="footer"> <footer class="foot"> PlugIncWW | Built by <a class="me" href="https://twitter.com/realdynobot" target="_blank">Vincent Nguyen</a> <a class="socials" href="https://twitter.com/plugincWW" target="_blank"><i class="fab fa-twitter"></i></a> <a class="socials" href="mailto:pluginc.help@gmail.com"><i class="far fa-envelope"></i></a> </footer> </div> </html>

CSS: /* Footer */ .footer { position: relative; right: 0; bottom: 0; left: 0; background-color: #ffffff; border-top: rgb(201, 198, 198) solid 1px; }

footer { top: 50%; position: relative; bottom: 0; height: 30px; width: 90%; padding: 10px; margin: 0 auto; color: white; top: 50%; }

.foot { color: rgb(102, 102, 102); }

.me { text-decoration: none; color: rgb(0, 155, 202) }

.me:hover { color: rgb(0, 124, 161) }

.socials { color: rgb(94, 94, 94); padding-right: 20px; float: right; transition: color 200ms; }

.socials:hover { color: rgb(0, 155, 202) }

.socials:active { color: rgb(0, 124, 161) }

1 Answer

Sam Gord
Sam Gord
14,060 Points

i think one way of doing this is that if the body element is the parent of the footer element, like this -->


then u can give the body element a relative position and the footer an absolute position like this, with a height value defined for body:

 position: relative;
 height: 100vh;

  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;

happy coding ;)

Worked on my home page but on the other pages it now cuts into the header of my page