Latest web development tutorials

HTML DOM Style alignItems property

Style Object Reference Style Objects

Examples

Align flexible <div> element items:

document.getElementById("myDIV").style.alignItems="center";

try it"

Definition and Usage

alignItems attribute specifies the default alignment of the flexible container.

Tip: Use each item attribute align-self realization rewritable align-items.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

IE11, Firefox, Chrome and Opera support alignItems property.

Version 9 and earlier Safari, IE does not support alignItems property. IE 10 required prefix MS.

grammar

Back alignItems properties:

object .style.alignItems

Setting alignItems properties:

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

Property Value

描述
stretch 默认值。项目被拉伸以适应容器。
center 项目位于容器的中心。
flex-start 项目位于容器的开头。
flex-end 项目位于容器的结尾。
baseline 项目位于容器的基线上。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: stretch
return value: String that represents align-items property element.
CSS version CSS3


related articles

CSS Reference: align = left-attribute items View

HTML DOM STYLE Reference: alignContent property

HTML DOM STYLE Reference: alignSelf property


Style Object Reference Style Objects