Style alignItems Property
Example
Center-align the items of a flexible
document.getElementById("myDIV").style.alignItems="center";
Try it »
Definition and Usage
The alignItems property specifies the default alignment of the items inside a flexible container.
**Tip:** Use the align-self property of each item to override the align-items setting.
Browser support





IE11, Firefox, Chrome, and Opera support the alignItems property.
Safari, IE 9 and earlier versions do not support the alignItems property. IE 10 requires the MS prefix.
Syntax
Return the alignItems property:
object
.style.alignItems
Set the alignItems property:
object
.style.alignItems="stretch|center|flex-start|flex-end|baseline|initial|inherit"
Attribute values
| Value | Description |
|---|---|
| stretch | Default. Items are stretched to fit the container. |
| center | Items are located at the center of the container. |
| flex-start | Items are located at the beginning of the container. |
| flex-end | Items are located at the end of the container. |
| baseline | Items are located at the baseline of the container. |
| initial | Sets this property to its default value. See initial. |
| inherit | Inherits this property from its parent element. See inherit. |
Technical Details
| Default value: | stretch |
|---|---|
| Return Value: | A string representing the align-items property of the element. |
| CSS version | CSS3 |
Related Articles
CSS Reference Manual:align-items Property
HTML DOM STYLE Reference Manual:alignContent Property
HTML DOM STYLE Reference Manual:alignSelf Property
The Style object