<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 800px;
height: 800px;
border: 2px solid red;
display: flex;
}
.box div{
width: 200px;
height: 200px;
background-color: chartreuse;
font-size: 50px;
text-align: center;
line-height: 200px;
/* 可以設置元素的三個樣式(彈性盒的三個狀態) 增長(flex-grow) 縮減(flex-shrink) 基礎(靜止時彈簧的長度 flex-base) */
flex:1 0 auto;
/* order 決定彈性元素的排列順序,數字越小,越靠前 */
order: 3;
}
.box div:nth-child(2){
background-color: coral;
order:0;
}
.box div:nth-child(3){
background-color: darkkhaki;
order:5;
}
</style>
</head>
<body>
<div class="box">
<div class="box1">1</div>
<div class="box2">2</div>
<div class="box3">3</div>
</div>
</body>
</html>