Style alignContent Property
Example
Position the items of the flexible <div> element with space between the lines:
document.getElementById("main").style.alignContent = "space-between";
Try it Yourself »
Definition and Usage
The alignContent property aligns the flexible container's items when the items do not use all available space on the cross-axis (vertically).
Tip: Use the justifyContent property to align the items on the main-axis (horizontally).
Note: There must be multiple lines of items for this property to have any effect.
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Numbers followed by Webkit specify the first version that worked with a prefix.
Property | |||||
---|---|---|---|---|---|
alignContent | 21.0 | 11.0 | 28.0 | 9.0 7.0 Webkit |
12.1 |
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 beginning of the container |
flex-end | Items are positioned at the end of the container |
space-between | Items are positioned with space between the lines |
space-around | Items are positioned with space before, between, and after the lines |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
Default Value: | stretch |
---|---|
Return Value: | A String, representing the align-content property of an element |
CSS Version | CSS3 |
Related Pages
CSS reference: align-content property
HTML DOM STYLE Reference: alignItems property
HTML DOM STYLE Reference: alignSelf property
HTML DOM STYLE Reference: justifyContent property