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 CSS Flexbox Layout Building a Layout with Flexbox Aligning Items to the Bottom of a Column

Mike Constantino
Mike Constantino
12,034 Points

Difference between align-self: flex-start and margin-right: auto in this situation?

In this video, Guil used: align-self: flex-start; to align the buttons to the left of the flex container. Could he not have just set the margin-right property to auto? This creates the same effect, right? What's the disadvantages of using the margin-right property over the align-self in this instance?

1 Answer

David Finley
David Finley
18,742 Points

I think it may just be a preference...if they both work. Similar to the 3 different ways to center an element in a flex container.

http://www.sketchingwithcss.com/samplechapter/cheatsheet.html says:

"You can control the align-items value for individual elements with align-self. You can also use margins to move individual elements up or down or left of right. e.g. on a column layout you can move an individual flex item all the way to the left of the container by setting margin-right: auto."