align-self | CSS-Tricks
The align-self property is a sub-property of the Flexible Box Layout module.
It makes possible to override the align-items value for specific flex items.
The align-self property accepts the same 5 values as the align-items:
flex-start: cross-start margin edge of the item is placed on the cross-start lineflex-end: cross-end margin edge of the item is placed on the cross-end linecenter: item is centered in the cross-axisbaseline: items are aligned such as their baseline are alignedstretch(default): stretch to fill the container (still respect min-width/max-width)
Syntax
align-self: auto | flex-start | flex-end | center | baseline | stretch
.flex-item {
align-self: flex-end;
}
Demo
The following demo shows how an item can align itself in the flex container depending on the align-self value:
- The 1st item is set to
flex-start - The 2nd item is set to
flex-end - The 3rd item is set to
center - The 4th item is set to
baseline - The 5th item is set to
stretch
Other Resources
- align-self in the spec
- align-self at MDN
- Advanced cross-browser flexbox
- A guide to Flexbox
- Using Flexbox
- Old Flexbox and new Flexbox
Browser Support
For more informations about how to mix syntaxes in order to get the best browser support, please refer to this article (CSS-Tricks) or this article (DevOpera).