css flex-direction属性介绍
CSS flex-direction属性是CSS弹性布局的一个属性,它用于设置弹性布局的主轴方向。它可以有四个值:row(默认值)、row-reverse、column、column-reverse。
css flex-direction属性使用方法
使用css flex-direction属性,可以通过设置主轴方向来控制弹性布局的内容排列方式。
row(默认值)
row值表示主轴方向为水平方向,内容排列从左到右。
.container {
display: flex;
flex-direction: row;
}
row-reverse
row-reverse值表示主轴方向为水平方向,内容排列从右到左。
.container {
display: flex;
flex-direction: row-reverse;
}
column
column值表示主轴方向为垂直方向,内容排列从上到下。
.container {
display: flex;
flex-direction: column;
}
column-reverse
column-reverse值表示主轴方向为垂直方向,内容排列从下到上。
.container {
display: flex;
flex-direction: column-reverse;
}