Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Layout Basics Getting Started with CSS Layout Creating a Sticky Footer

Christine Mackay
Christine Mackay
3,477 Points

Sticky footer sticks to bottom but scrollbar is still there (i.e. the footer is too far down the page).

I followed this video that uses the calc() function to add this to my CSS code:

.wrap { min-height: calc(100vh - 89px); }

However, the footer is still too low down, despite having minused 89px. My scrollbar is still there and I have to scroll down slightly to see the rest of the footer. It's stuck too low. I've tried changing the number of pixels I minus from the 100vh, and it moves the footer up a bit, but I really want to know why the code in the video is not working.

Can you post a snapshot? Click the camera icon in the upper right corner, click 'Take Snapshot' and then post the link that is created here.

1 Answer

Here is a snapshot using the workspace from the video

In your css under

/* ================================= 
  Base Element Styles
==================================== */

you are missing a rule for p:last-child

p:last-child {
    margin-bottom: 0;
}

and under

/* ================================= 
  Base Layout Styles
==================================== */

the rule for .main-header has

padding: 1.5em 0;

instead of

padding: 1em 0;

With those changes the footer should appear correctly

Christine Mackay
Christine Mackay
3,477 Points

Thanks :-) It worked but I don't understand why those things need to be changed. I didn't even write the CSS file, only the calc() bit, the rest is what was given to us in the workshop, and the given CSS given worked just fine in the video without the changes you mentioned.

Could this video just be outdated or something? Or the workplace was given to us with errors?