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 How to Make a Website CSS: Cascading Style Sheets Center the Wrapper

Bartosz Brzezinski
Bartosz Brzezinski
4,468 Points

No min-width?

Why is there no need to express the min-width for the wrapper? What is it then?

http://teamtreehouse.com/library/how-to-make-a-website/css-cascading-style-sheets/center-the-wrapper

Richard Duncan
Richard Duncan
5,568 Points

Hi Bartosz, which code challenge are you looking at? would it be possible to add a link to it in your question?

2 Answers

Richard Duncan
Richard Duncan
5,568 Points

If no width value is defined it is assumed the width is 100% of the containing element. max-width overrides the width property to define an upper bound. Essentially you are saying in shorthand that the width is 100% of the container except where that container exceeds 940px at which point #wrapper is 940px wide.

So if you have a body of 1000px then wrapper is 940px. If your body is 500px wide then wrapper is 100% wide (or 500px).

Bartosz Brzezinski
Bartosz Brzezinski
4,468 Points

Thank you. That makes perfect sense.

Bartosz Brzezinski
Bartosz Brzezinski
4,468 Points

#wrapper { max-width: 940px; margin: 0 auto; padding: 0 5%; }

this is the code for the wrapper. There is a maximum value to prevent it from being wider than 940px, but what determines its width otherwise?