Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style alignContent Property

Style alignContent Property

Style Object Reference The Style object

Example

Align the items of a flexible

container:

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

Try it »


Definition and Usage

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

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

**Note:** The container must have multiple lines of items for this property to have a visible 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"

Attribute values

Value Description
stretch Default. Items are stretched to fit the container.
center Items are located at the center of the container.
flex-start Items are located at the beginning of the container.
flex-end Items are located at the end of the container.
space-between Items are located in a container with space left between the lines.
space-around Items are located in a container with space left before, between, and after each line.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical Details

Default value: stretch
Return Value: A string representing the align-content property of the element.
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 Object Reference The Style object