English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Complete List of CSS Properties

CSS3 align-Usage and examples of content property

Description

align-When there is extra space (vertical) on the horizontal axis, the CSS property can align elements in the flexible container to the flexible container. This property has no effect on single-line flexible containers. In addition, you can use CSS justify-contentAligns elements on the main axis (horizontal) of the property.

The following table summarizes the usage context and version history of this property.

Default value:stretch
Applies to:Multi-line flexible container
Inheritance:None
Animatable:No.See also Animation properties.
CSS version:CSS3
New feature ofJavaScript syntax: object.style.alignContent="center"

align-Syntax of content usage

The syntax of this property is as follows:

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

The following examples show how to use CSS's align-content property.

 .flex-container {
           /* Safari Browser */
           display: -webkit-flex; 
           -webkit-flex-flow: row wrap;
           -webkit-align-content: space-around;
           /* Standard Syntax */
           display: flex;
           flex-flow: row wrap;
           align-content: space-around;
    }
Test See‹/›

Attribute Values

The following table describes the values of this property.

ValueDescription
centerThe element is located at the center of the flexible container.
flex-startThe element is located at the beginning of the flex container.
flex-endThe element is located at the end of the flex container.
space-betweenThe element is evenly distributed in the flexible container to make the space between two adjacent elements the same.
space-aroundThe element is evenly distributed in the flex container to make the space around each element (i.e., before, between, and after) the same.
stretchStretch the element to fit the flexible container. Available space is evenly distributed among all elements. This is the default value.
initialSet this property to its default value.
inheritIf specified, the associated element uses the computed value of the align attribute of its parent element.-content.

Browser Compatibility

align-All mainstream browsers support this property. The number represents the version number of the first browser that supports the property.

  • Firefox 28+

  • Google Chrome21+

  • Internet Explorer 11+

  • Apple Safari 7+ -webkit-

  • Opera 12.1+

Note: Apple Safari 7and higher versions to support this align-content property, but it needs-webkit-prefix, for example-webkit-align-content: center;

Read More

Please refer to the following tutorials:CSS Alignment.

Related Attributes:align-items,align-self,display,flex,flex-basis,flex-direction,flex-flow,flex-grow,flex-shrink,flex-wrap,justify-content,min-height,min-width,order.