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 trialChris Nelson
4,978 PointsMargin values in CSS - to "center" ?
I can't understand this question after the related video:
Select the ID wrapper, set it to a max width of 940 pixels, and then center it on the page using the margin property.
I tried
wrapper { max-width: 940px; margin: center; }
Msg - Bummer! Check the margin values...
Am I supposed to use a % and guess in order to center the margin ?
confused. the original video doesn't clarify.
thanks in advance for your help.
4 Answers
Sarah Warner
26,026 PointsNo, you don't need to guess in order to center the margin. But you don't want to use margin: center;
Nick mentioned it in the video (you may want to review), but in order to center the, use wrapper {margin: 0 auto;}
Good luck!
Jesse Brownstein
5,111 PointsSarah is correct. You will need to use the style 'margin: 0 auto'. There is no value 'center' for the margin property.
jaredcowan
11,808 PointsYou were pretty close on the first one. You don't use "center" on this...Think of autopilot.
You want it to do something automatically, regardless of the screen size.
Chris Nelson
4,978 PointsThanks all, for your help !
Chris Nelson
4,978 PointsChris Nelson
4,978 PointsOkay. Thanks. It worked this time. I tried {margin: 0 auto;} but something made it not work the first time.
BTW, I wish there was a way you can skip forward and fail the code challenge so you can return to reviewing the video again and take the code challenge. The way it works now is, when you don't get a code challenge correct, there's no way to go forward or back until you get it right, which feels entrapping. When you take a quiz, you move forward whether you answer right or not. Just a suggestion for functionality. Perhaps if this functionality observation could be "uploaded" to the right people?
Thanks again, --Chris N