Style alignSelf 属性

Style 对象参考手册 Style 对象

实例

居中对齐灵活元素内的某个项目:

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

尝试一下 »

定义和用法

alignSelf 属性规定灵活容器内被选中项目的对齐方式。

注意:alignSelf 属性可重写灵活容器的 alignItems 属性。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Firefox、Opera 和 Chrome 支持 alignSelf 属性。

语法

返回 alignSelf 属性:

object.style.alignSelf

设置 alignSelf 属性:

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

属性值

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

技术细节

默认值:auto
返回值:字符串,表示元素的 align-self 属性。
CSS 版本CSS3


相关文章

CSS 参考手册:align-self 属性

HTML DOM STYLE 参考手册:alignContent 属性

HTML DOM STYLE 参考手册:alignItems 属性


Style 对象参考手册 Style 对象

0 个评论

要回复文章请先登录注册