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

Michael Heads
Michael Heads
8,739 Points

Why is the wrap class being placed in the media query?

Why is the class being placed in the media query, in my code the footer is not at the bottom of the page at desktop screen size.

2 Answers

Dylan Conroy
Dylan Conroy
9,144 Points

Iā€™m guessing he does this because the content will be scrollable on tablet and mobile, so the footer would just sit on bottom already.

Paul Walker
Paul Walker
28,904 Points

The reason you put it in the media query is that on your phone you do not have to worry about the footer because of your scrolling the content. You may want to control your tablet and desktop so that your footer sticks to the bottom of your viewport. You put a wrapper class to control the min-height of your viewport. The wrapper goes before the body tag and just above the footer tag. You then use the calc function and subtract the footer height from it. Example min-height: calc(100vh - 89px); As shown on the video. Hope this helps.