效果图:
代码:
<!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 {
height: 500px;
width: 500px;
border: 1px solid black;
margin: 100px auto;
display: flex;
/*主轴改为竖直方向*/
/* flex-direction: column; */
align-items: center;
align-content: center;
}
.box div {
width: 70px;
height: 70px;
border: 1px solid blue;
}
.div1 {
}
.div2 {
flex: 1;
}
.div3 {
}
</style>
</head>
<body>
<div class="box">
<div class="div1">111111</div>
<div class="div2">222222</div>
<div class="div3">333333</div>
</div>
</body>
</html>