Style flexDirection 屬性
示例
重新排列 <div> 元素內的彈性項的方向
document.getElementById("main").style.flexDirection = "column-reverse";
自己動手試一試 »
描述
flexDirection 屬性用於設定或返回彈性項的方向。
注意: 如果該元素不是彈性項,flexDirection 屬性將無效。
瀏覽器支援
屬性 | |||||
---|---|---|---|---|---|
flexDirection | 是 | 11.0 | 是 | 9.0 | 是 |
語法
返回 flexDirection 屬性
object.style.flexDirection
設定 flexDirection 屬性
object.style.flexDirection = "row|row-reverse|column|column-reverse|initial|inherit"
屬性值
值 | 描述 |
---|---|
row(行) | 預設值。彈性項水平顯示,如一行 |
row-reverse(反向行) | 與 row 相同,但順序相反 |
column(列) | 彈性項垂直顯示,如一列 |
column-reverse(反向列) | 與 column 相同,但順序相反 |
initial | 將此屬性設定為其預設值。閱讀關於 initial |
inherit | 從其父元素繼承此屬性。閱讀關於 inherit |
技術詳情
預設值 | row(行) |
---|---|
返回值 | String 型別,表示元素的 flex-direction 屬性 |
CSS 版本 | CSS3 |
相關頁面
CSS 參考:flex-direction 屬性
HTML DOM STYLE 參考:flex 屬性
HTML DOM STYLE 參考:flexBasis 屬性
HTML DOM STYLE 參考:flexFlow 屬性
HTML DOM STYLE 參考:flexGrow 屬性
HTML DOM STYLE 參考:flexShrink 屬性
HTML DOM STYLE 參考:flexWrap 屬性