Style alignItems Property
Example
Position the alignments for all the items of the flexible <div> element at the beginning of the container:
document.getElementById("main").style.alignItems = "flex-start";
Try it Yourself »
Description
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.
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 |
Browser Support
alignItems
is a CSS3 (1999) feature.
It is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |
Related Pages
CSS reference: align-items property
HTML DOM STYLE Reference: alignContent property
HTML DOM STYLE Reference: alignSelf property
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.