主轴方向:
属性值 | 作用 |
---|
row | 行,水平(默认值),从左到右 |
column | 列,垂直,从上到下* |
row-reverse | 行,从右到左 |
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 {
margin: 100px auto;
display: flex;
width: 400px;
height: 400px;
border: 1px solid #000;
/* 主轴 从左到右 (默认) row*/
/* 主轴 从右到左 */
/* flex-direction: row-reverse; */
/* 主轴 从上到下 */
/* flex-direction: column; */
/* 主轴 从下到上 */
/* flex-direction: column-reverse; */
}
.box div {
width: 100px;
height: 100px;
background-color: pink;
}
</style>
</head>
<body>
<div class="box">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
</body>
</html>