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.

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.