Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style alignItems Property

Style alignItems Property

Style Object Reference The Style object

Example

Center-align the items of a flexible

container:

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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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


Style Object Reference The Style object