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 對象