CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES
Advertisements

CSS3 align-content Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The align-content CSS property aligns the flexible container's items within the flex container when there is extra space on the cross-axis (vertically).

This property has no effect on single line flexible boxes. Moreover you can use the CSS justify-content property to align the items on the main-axis (horizontally).

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

Default value: stretch
Applies to: Multi-line flex containers
Inherited: No
Animatable: No. See animatable properties.
Version: New in CSS3

Syntax

The syntax of the property is given with:

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

The example below shows the align-content property in action.

.flex-container {
    /* Safari */
    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;
}

Property Values

The following table describes the values of this property.

Value Description
center Items are positioned at the center of the flex container.
flex-start Items are positioned at the beginning of the flex container.
flex-end Items are positioned at the end of the flex container.
space-between Items are evenly distributed in the flex container in such a way that the space between two adjacent items is same.
space-around Items are evenly distributed in the flex container so that the spaces around (i.e. before, between, and after) every item are same.
stretch Items are stretched to fit the flex container. The free-space is divided equally between all the items. This is default value.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element align-content property.

Browser Compatibility

The align-content property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 28+
  • Google Chrome 21+
  • Internet Explorer 11+
  • Apple Safari 7+ -webkit-
  • Opera 12.1+

Note: Apple Safari version 7 and above supports the align-content property but require -webkit- prefix, like this -webkit-align-content: center;


Further Reading

See tutorial on: CSS Alignment.

Related properties: 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.

Advertisements
Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties