正常盒模型主轴侧轴默认水平
修改主轴侧轴
1.flex-direction: row 默认水平排列
2.flex-direction: column 竖直排列
3.flex-direction: row-reverse 水平取反
4.flex-direction: column-reverse 竖直取反
以下是代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 500px;
height: 500px;
border: 2px solid black;
margin: 100px auto;
display: flex;
/* 弹性盒 */
flex-direction: column-reverse;
/*
修改主轴侧轴
1.row 默认水平排列
2.column 竖直排列
3.row-reverse 水平取反
4.column-reverse 竖直取反
*/
}
.box div{
width: 100px;
height: 100px;
border: 2px dashed red;
}
</style>
</head>
<body>
<div class="box">
<div>1111</div>
<div>2222</div>
<div>3333</div>
<div>4444</div>
</div>
</body>
</html>