CSS align-items Property
Example
Center the alignments for all the items of the flexible <div> element:
div
{
display: -webkit-flex; /* Safari */
-webkit-align-items: center; /* Safari 7.0+ */
display: flex;
align-items: center;
}
Try it Yourself »
Definition and Usage
The align-items
property specifies the default alignment for items inside the flexible container.
Tip: Use the align-self property of each item to override the align-items
property.
Default value: | stretch |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS3 |
JavaScript syntax: | object.style.alignItems="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.
Property | |||||
---|---|---|---|---|---|
align-items | 21.0 | 11.0 | 20.0 | 9.0 7.0 -webkit- |
12.1 |
CSS Syntax
align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit;
Property Values
Value | Description | Play it |
---|---|---|
stretch | Default. 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 » |
baseline | Items are positioned at the baseline of the container | 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-content property
CSS Reference: align-self property
HTML DOM reference: alignItems property