Style alignContentProperty

Style 对象参考手册Style Object

Example

Align the items of a flexible <div> element:

document.getElementById("myDIV").style.alignContent="center";

Try it Yourself »

Definition and Usage

The alignContent property aligns the items of a flexible container when the items do not occupy all available space on the cross-axis (vertically).

Tip:Use the justifyContent property to align the items on the main axis (horizontally).

Note:The container must have multiple rows of items for this property to take effect.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Chrome and Opera support the alignContent property.


Syntax

Return the alignContent property:

object.style.alignContent

Set the alignContent property:

object.style.alignContent="stretch|center|flex-start|flex-end|space-between|space-around|initial|inherit"

Property Values

Value Description
stretch Default value. Items are stretched to fit the container.
center Items are positioned at the center of the container.
flex-start Items are positioned at the start of the container.
flex-end Items are positioned at the end of the container.
space-between Items are positioned in a container with blank space between the rows.
space-around Items are positioned in a container with blank space before, between, and after the rows.
initial Sets this property to its default value. Seeinitial。
inherit Inherits this property from its parent element. Seeinherit。

Technical Details

Default value: stretch
Return value: A string, representing the element's align-content property.
CSS Version CSS3


Related Articles

CSS Reference Manual:align-content property

HTML DOM STYLE Reference Manual:alignItems property

HTML DOM STYLE Reference Manual:alignSelf property

HTML DOM STYLE Reference Manual:justifyContent property


Style 对象参考手册Style Object

Other Extensions