align-self

Avatar of 34 Cross
34 Cross on (Updated on )

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 line
  • flex-end: cross-end margin edge of the item is placed on the cross-end line
  • center: item is centered in the cross-axis
  • baseline: items are aligned such as their baseline are aligned
  • stretch (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

See the Pen align-self demo by CSS-Tricks (@css-tricks) on CodePen.

Related Properties

Other Resources

Browser Support

This browser support data is from Caniuse, which has more detail. A number indicates that browser supports the feature at that version and up.

Desktop

ChromeFirefoxIEEdgeSafari
21*2811126.1*

Mobile / Tablet

Android ChromeAndroid FirefoxAndroidiOS Safari
1231244.47.0-7.1*

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).