Align Items

Control alignment of items along the cross axis.

The alignItems property controls Flexbox items along the cross axis and Grid items along the block axis. Grid's justifyItems uses the same AlignItems values for the inline axis. Both properties are initially undefined, allowing the layout algorithm to choose its default alignment, commonly stretching auto-sized items.

Values

ValueDescription
StretchItems stretch to fill the container's cross size (respecting min/max constraints).
Start / EndAlign to the container's logical start/end edge.
SelfStart / SelfEndAlign using the item's own direction rather than the container's direction.
FlexStartItems align to the start edge of the cross axis.
FlexEndItems align to the end edge of the cross axis.
CenterItems align in the center of the cross axis.
BaselineItems align using the baselines calculated by Taffy.

The measurement callback returns dimensions only; it does not accept a custom text baseline.

SafeStart, SafeEnd, SafeFlexStart, SafeFlexEnd, SafeCenter, SafeSelfStart, and SafeSelfEnd provide safe alignment. When the requested alignment would place overflowing content before the start edge, safe alignment falls back to start alignment. The corresponding values without Safe retain their requested alignment even when content overflows.

Example

Loading Preview…

Next Steps

© 2026 ByteLand Technology Limited