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 trialDarrell Osborne
23,146 Pointsp:last-child margin-bottom set to zero
I was following along with the previous workspace for the sticky footer, and after adding the .wrap class, rule, and calc, the footer was still being pushed a few pixels beyond the view port. I noticed that the new workspace for this video had added the p:last-child rule and set the bottom margin to zero. Once I added that to the previous workspace all was well.
Just wondering why was zeroing out the bottom margin necessary for the calc function to work the way we wanted?
1 Answer
Guil Hernandez
Treehouse TeacherHi Darrell Osborne,
The :last-child
rule is for this lesson only -- it's not usually necessary. By default, that paragraph's bottom margin collapses with the footer so it pushes it down a few extra pixels. Normally, that content might be in a floated or inline-block column, so you wouldn't experience the collapsing margin. Even adding a little bottom padding to .container
would prevent it from collapsing and pushing the footer beyond the viewport -- try it. :)
Again, for this example, I only wanted to focus on the .wrap
element, the footer and calc()
function. You'll learn more about the rest in the next sections. :)
Darrell Osborne
23,146 PointsDarrell Osborne
23,146 PointsThanks Guil Hernandez! I wondered if that was the case shortly after I posted the question, but didn't have time until now to mess around with it. Thanks for explaining!