通过伪类在div中添加一个背景图片
.box_center::after {
content: "";
display: block;
width: 40px;
height: 40px;
background: url(/images/bank.png) no-repeat;
background-size: 40px 40px;
margin-top: -70px;
margin-left: 80px;
}
<!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,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<title>flex - 弹性盒 - 两边固定,中间伸缩</title>
</head>
<style>
body {
margin: 0 0;
}
.box {
height: 100px;
background-color: antiquewhite;
}
.box_left {
width: 100px;
height: 100px;
position: absolute;
left: 0;
top: 0;
line-height: 100px;
text-align: center;
background-color: rgb(176, 240, 163);
}
.box_right {
position: absolute;
right: 0;
top: 0;
width: 100px;
height: 100px;
line-height: 100px;
text-align: center;
background-color: rgb(175, 202, 238);
}
.box_center {
height: 100px;
margin-left: 100px;
margin-right: 100px;
line-height: 100px;
text-align: center;
background-color: rgb(248, 248, 248);
font-size: 22px;
border-radius: 10px;
border: 1px red solid;
}
.box_center::after {
content: "";
display: block;
width: 40px;
height: 40px;
background: url(/images/bank.png) no-repeat;
background-size: 40px 40px;
margin-top: -70px;
margin-left: 80px;
}
</style>
<body>
<div class="box">
<div class="box_left">
左边固定
</div>
<div class="box_center">
中间随着窗口大小自动伸缩
</div>
<div class="box_right">
右边固定
</div>
</div>
</body>
</html>