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

General Discussion

What I am missing - CSS

below is the code challenge and my answer which seems right but TTH tells me that it is wrong!!!!

Select the wrapper, set a max width of 940 pixels, and then center it on the page using the margin property.

.wrapper { max-width: 940px; margin-left: auto; margin-right: auto; }

2 Answers

To center an element you should use:

margin: 0 auto;

That is the same as what I did except in shorthand but does not answer the question about why the line margin: 0 auto; is incorrect as per TTH. Thank you though!

Can you link me to the challenge.

Can you link me to the challenge.

Also be sure that your selector is correct. You could be using a class selector

.wrapper{
max-width: 940px;
margin: 0 auto;
}

When you should be using an id selector

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

Hi Ricardo, I just figured it out and so did you. The issue was that it is an ID tag not a class - except that TTH challenge does not mention that on the question and there is no html file that comes with the challenge. Thanks again. be well!