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.