THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Style alignItems Property

Style Object Reference Style Object

Example

Position the alignments for all the items of the flexible <div> element at the beginning of the container:

// Code for Safari 7.0+
document.getElementById("main").style.WebkitAlignItems = "flex-start";

// Standard syntax
document.getElementById("main").style.alignItems = "flex-start";
Try it Yourself »

Definition and Usage

The alignItems 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.


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
alignItems 21.0 11.0 20.0 7.0 Webkit 12.1

Note: Safari support an alternative, the WebkitAlignItems property.


Syntax

Return the alignItems property:

object.style.alignItems

Set the alignItems property:

object.style.alignItems="stretch|center|flex-start|flex-end|baseline|initial|inherit"

Property Values

Value Description
stretch Default. Items are stretched to fit the container
center Items are positioned at the center of the container
flex-start Items are positioned at the beginning of the container
flex-end Items are positioned at the end of the container
baseline Items are positioned at the baseline of the container
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: stretch
Return Value: A String, representing the align-items property of an element
CSS Version CSS3

Related Pages

CSS reference: align-items property

HTML DOM STYLE Reference: alignContent property

HTML DOM STYLE Reference: alignSelf property


Style Object Reference Style Object