CSS align-content Property


Align the items of the flexible <div> element:

div {
    display: -webkit-flex; /* Safari */
    -webkit-flex-flow: row wrap; /* Safari 6.1+ */
    -webkit-align-content: space-around; /* Safari 7.0+ */
    display: flex;
    flex-flow: row wrap;
    align-content: space-around;

Try it yourself »

Definition and Usage

The align-content property aligns the flexible container's items when the items do not use all available space on the cross-axis (vertically).

Tip: Use the justify-content 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.

Default value: stretch
Inherited: no
Animatable: no. Read about animatable
Version: CSS3
JavaScript syntax: object.style.alignContent="center" Try it

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.

align-content 21.0 11.0 28.0 7.0 -webkit-  12.1

CSS Syntax

align-content: stretch|center|flex-start|flex-end|space-between|space-around|initial|inherit;

Property Values

Value Description Play it
stretch Default value. Items are stretched to fit the container Play it »
center Items are positioned at the center of the container Play it »
flex-start Items are positioned at the beginning of the container Play it »
flex-end Items are positioned at the end of the container Play it »
space-between Items are positioned with space between the lines Play it »
space-around Items are positioned with space before, between, and after the lines Play it »
initial Sets this property to its default value. Read about initial Play it »
inherit Inherits this property from its parent element. Read about inherit

Related Pages

CSS Reference: align-items property

CSS Reference: align-self property

CSS Reference: justify-content property

HTML DOM reference: alignContent property




Search w3schools.com:

Translate w3schools.com: