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


max-width and padding

In stage 4 of "How to make a website" i.e CSS: Cascading Style Sheets,

Nick writes a css code
wrapper { max-width: 940px; margin: 0 auto; padding: 0 5%; }

and explains the property "max-width: 940px" that, we want the width to be no larger than 940 pixels across, then how come when we add the padding property to be "padding: 0 5%;" the max-width goes larger than 940px, then whats the purpose of "max-width" ??

2 Answers

The max-width is the width of the content area. So te padding wil be added, but the width of the content area wil never be wider than 940px

Ok got it, Thanks.