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 Style the Basic Elements

What am I doing wrong?

wrapper {

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

css/main.css
#wrapper {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}

The requirement is to center the element, but i get it wrong for some reason.

The requirement is to center the element, but i get it wrong for some reason.

The requirement is to center the element, but i get it wrong for some reason.

2 Answers

and then center it on the page using the margin property.

Hi, there. The challenge is asking you to use of margin property ONLY; not margin-left or margin-right.

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

Thanks William you are my angel. :)

you need to use margin 0 auto like this

wrapper {

max-width: 940px; margin: 0 auto; }