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

Background color goes past max-width

I have a site where I've defined the max-width to be 1900px and a background color of #fef8fc.

If I use Chrome DEV tools and simulate a screen size greater than 1900px like 2400px, I notice the defined background colors extends past the 1900px. Shouldn't it stop at 1900px? How do I get it to be confined to the max-width like the other elements?

1 Answer

Try using the box-sizing: border-box property to the * selector.

Thanks Aaron,

the CSS file already has this section, which I think matches your suggestion.

/* Box Sizing --------------------------------------------- */

*, input[type="search"] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }