<!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{
border: 1px solid black;
display: flex;
}
.item{
width: 150px;
height: 100px;
line-height: 100px;
border: 1px solid salmon;
color: salmon;
font-size: 40px;
font-weight: 800;
text-align: center;
}
.item:nth-child(4){ /*()为索引 */
flex: 1;/*分配剩余的宽度*/
}
.item:nth-child(5){
flex: 2;/*分配剩余的宽度*/
}
</style>
</head>
<body>
<p>如果一行有多个块级元素,可以用弹性盒子</p>
<div class="box">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
</div>
</body>
</html>