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

HTML How to Make a Website CSS: Cascading Style Sheets Center the Wrapper

"auto" help.

Could I get some clarification when he explains what "auto" is doing at 2:56? What does it mean that it will fill it in with whatever is left over?

What would happen if we didn't type in "auto" there?

Cindy Lea
Cindy Lea
Courses Plus Student 6,497 Points

Auto in this case means the browser determines the justification. The default is auto so if you leave it out it will be the same affect.

1 Answer

Florian Tönjes
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Florian Tönjes
Full Stack JavaScript Techdegree Graduate 50,856 Points

Diego,

the '0 auto' as a margin value means, that the browser will check how wide the wrapper element is. It then substracts the wrapper's width from the total width of it's parent element. Now the browser knows how much space of the parent element is not occupied on the sides. It divides this space by two and applies it as margin to both sides of the wrapper, so that it is centered within it's parent element. Without the 'auto' value the wrapper would just stick to the left side.

Regards, Florian

Ohhh, that makes sense! Awesome, thanks :)