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 trialgene c
13,630 PointsWhy does margin-top: auto place the item at the bottom of the container?
I thought the value "auto" would center the item, and place the button in the middle of the container.
1 Answer
Justin Cantley
18,068 PointsIf you want to center the element with auto, then you cannot be as specific as targeting a single side of the element.
For instance:
margin: auto;
will center the item, but
margin-top: auto;
will just cause the browser to select a suitable margin to use, which in this case will push it to the bottom.