Latest web development tutorials

HTML DOM Style alignSelf property

Style Object Reference Style Objects

Examples

Align flexible elements within a project:

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

try it"

Definition and Usage

alignSelf within the flexible container attribute specifies the selected project alignment.

Note: alignSelf property rewritable alignItems attribute flexible container.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Firefox, Opera and Chrome support alignSelf property.

grammar

Back alignSelf properties:

object .style.alignSelf

Setting alignSelf properties:

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

Property Value

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

technical details

Defaults: auto
return value: String that represents align-self attributes of the element.
CSS version CSS3


related articles

CSS Reference: align = left-Self properties

HTML DOM STYLE Reference: alignContent property

HTML DOM STYLE Reference: alignItems property


Style Object Reference Style Objects