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

Div breaking out of html

Hi there!

I made a sticky footer using a page wrapper, as explained here: https://css-tricks.com/snippets/css/sticky-footer/

html, body{
    height: 100%;
}

.page-wrap {
  min-height: 100%;
  /* equal to footer height */
  margin-bottom: -100px; 
}
.page-wrap:after {
  content: "";
  display: block;
  height: 100px;
}

Now the thing is that the wrapper div breaks out of the html & body containers. And with that I mean that the html & body will be 100% of my viewport, but if the content of the wrapper div is bigger than my viewport, this div will break out of the html and body elements. I guess this has something to do with the min-height setting. Anyway, it's not a real problem for me and everything works fine, but it just doesn't seem very clean and best practice. Any thoughts from you guys on this code?

Yes you are right it has to do with height. If you see the code they posted they have this :after rule that sets height to .site-footer and page-wrap.