The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

Values

In absolutely-positioned layouts, the keyword behaves like start on replaced absolutely-positioned boxes, and as stretch on all other absolutely-positioned boxes.

In static position of absolutely-positioned layouts, the keyword behaves as stretch.

For flex items, the keyword behaves as stretch.

For grid items, this keyword leads to a behavior similar to the one of stretch, except for boxes with an aspect ratio or an intrinsic sizes where it behaves like start.

The property doesn't apply to block-level boxes, and to table cells.

self-start

Aligns the items to be flush with the edge of the alignment container corresponding to the item's start side in the cross axis.

self-end

Aligns the items to be flush with the edge of the alignment container corresponding to the item's end side in the cross axis.

flex-start

The cross-start margin edge of the flex item is flushed with the cross-start edge of the line.

flex-end

The cross-end margin edge of the flex item is flushed with the cross-end edge of the line.

center

The flex item's margin box is centered within the line on the cross-axis. If the cross-size of the item is larger than the flex container, it will overflow equally in both directions.

baseline
first baselinelast baseline

Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box’s first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group.
The fallback alignment for first baseline is start, the one for last baseline is end.

stretch

If the combined size of the items along the cross axis is less than the size of the alignment container and the item is auto-sized, its size is increased equally (not proportionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size of all auto-sized items exactly fills the alignment container along the cross axis.

safe

If the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start.

unsafe

Regardless of the relative sizes of the item and alignment container, the given alignment value is honored.

auto computes to itself on absolutely-positioned elements, and to the computed value of align-items on the parent (minus any legacy keywords) on all other boxes, or start if the box has no parent. Its behavior depends on the layout model, as described for justify-self. Otherwise the specified value.

Notes Older versions of the specification treat absolute positioned children as though they are a 0 by 0 flex item. Later specification versions take the children out of the flow and set their positions based on align and justify properties. Chrome implements the new behavior beginning with Chrome 52.

Full support
21

Prefixed

Prefixed Implemented with the vendor prefix: -webkit-

EdgeFull support
12

FirefoxFull support
20

Notes

Full support
20

Notes

Notes Before Firefox 27, only single-line flexbox is supported.

No support18 — 20

Disabled

Disabled From version 18 until version 20 (exclusive): this feature is behind the layout.css.flexbox.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.

Full support
49

Prefixed

Prefixed Implemented with the vendor prefix: -webkit-

Full support
48

PrefixedDisabled

Prefixed Implemented with the vendor prefix: -webkit-

Disabled From version 48: this feature is behind the layout.css.prefixes.webkit preference (needs to be set to true). To change preferences in Firefox, visit about:config.

IEFull support
11

OperaFull support
12.1

SafariNo support
No

WebView AndroidFull support
37

Full support
37

Partial support4.4

Notes

Notes Older versions of the specification treat absolute positioned children as though they are a 0 by 0 flex item. Later specification versions take the children out of the flow and set their positions based on align and justify properties. Chrome implements the new behavior beginning with Chrome 52.

Full support
Yes

Prefixed

Prefixed Implemented with the vendor prefix: -webkit-

Chrome AndroidFull support
36

Full support
36

Partial support29

Notes

Notes Older versions of the specification treat absolute positioned children as though they are a 0 by 0 flex item. Later specification versions take the children out of the flow and set their positions based on align and justify properties. Chrome implements the new behavior beginning with Chrome 52.