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.

Ingrid Bardales
10,616 Pointstrying to understand margin: 0 auto 30px;
I understand 'margin: 0 auto' centers but why in this example is 30px added?
profile-photo { display: block; max-width: 150px; margin: 0 auto 30px; border-radius: 100% }
3 Answers

Jason Anello
Courses Plus Student 94,596 PointsHi Ingrid,
When you specify 3 values for margin the 1st value is for the top margin, the 2nd value is for the left and right margin, and the 3rd value is for the bottom margin.
So in this case Nick simply wanted to have 30px of margin below the profile photo. Had he used 0 auto
then both the top and bottom margin would be 0.

Ingrid Bardales
10,616 PointsThank you Guy, now i get it, it was driving me crazy. I would center stuff buy didn't understand the logic behind the 'auto' syntax.

Guy Noda-Bailey
18,837 PointsGlad the forums could help. I always find it so much easier to remember stuff when I understand why it works as opposed to just what to type.

Ingrid Bardales
10,616 PointsThank you Mousa, for stopping by also!
Ingrid Bardales
10,616 PointsIngrid Bardales
10,616 PointsThank you Jason ok i got it. Just one question..I am having a hard time understanding "auto" how does this work? Thanx a million!
Mousa Alqarni
22,619 PointsMousa Alqarni
22,619 Pointsgood my friend you got point for that . i know about that but i am happy we are helping others to improve for better .
Guy Noda-Bailey
18,837 PointsGuy Noda-Bailey
18,837 PointsThe auto part centers the element by auto*magic*aly, making the margins on the left and right the same amount.