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

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.