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 the 'items' property

align-The 'items' property specifies the default alignment for elements within a flex container.

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

Default value:stretch
Applies to:Flexible container
Inheritance:None
Animated:No.Please see Animation properties.
Version:CSS3new feature
JavaScript syntax:object.style.alignItems="center"

align-items syntax usage

The syntax of this property is as follows:

align-items: baseline | center | flex-start | flex-end | stretch | initial | inherit

The following examples show the align being used.-items property.

 .flex-container {
           /* Safari */
           display: -webkit-flex; 
           -webkit-align-items: center;
           
           display: flex;
           align-items: center;
   }
Test and see‹/›

Attribute value

The following table describes the values of this property.

ValueDescription
baselineThe element is located at the baseline of the flexible container.
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.
stretchStretch the element to fit the flexible container. The available space is evenly distributed among all elements. This is the default value.
initialSet this property to its default value.
inheritIf specified, the associated elements will use the align of their parent element's property.-items values.

Browser compatibility

align-Browser compatibility of the items property, all major browsers support this property.

  • Firefox 20+

  • Google Chrome21+

  • Internet Explorer 11+

  • Apple Safari 7+ -webkit-

  • Opera 12.1+

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

Further reading

Please refer to the following tutorials:CSS Alignment.

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