Flexbox main axis alignment of individual items with margin: auto

On the cross axis of a flexbox align-self can control the alignment of individual items. There is no equivalent justify-self property for the main axis. Instead you can achieve this by setting margin: auto on items. Free space is essentially divided up between margin: autos.

Examples

Adding left margin to the rightmost element pushes it to the right:

a
b
c
margin-left: auto

Adding both margins centers the element in the free space:

a
b
c
margin-left: auto
margin-right: auto

Multiple elements with margins will divide the free space between them:

b
margin-left: auto
b
c
margin-left: auto
margin-right: auto

It doesn't matter which element the margin is assigned to:

b
margin-left: auto
b
margin-right: auto
c
margin-right: auto

If two elements have a margin in the same space they each get a share of the divided space, they don't combine together:

b
margin-left: auto
b
margin-right: auto
c
margin-left: auto
margin-right: auto