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 »
Description
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.
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 |
Browser Support
alignContent is a CSS3 (1999) feature.
It is fully supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Yes | Yes | Yes | Yes | Yes | 11 |
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