定位
父类相对定位,子类绝对定位,左右宽高固定,位置固定。中间部分设置高度,设置左右的margin:margin-left = 左边元素宽度;同理右边
<!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>
.father {
position: relative;
}
.left {
width: 100px;
height: 100px;
background: sienna;
position: absolute;
left: 0;
}
.right {
width: 100px;
height: 100px;
background: springgreen;
position: absolute;
right: 0px;
top: 0px;
}
.center {
height: 100px;
background: thistle;
margin-left: 100px;
margin-right:100px;
}
</style>
</head>
<body>
<div class="father">
<div class="left">左边</div>
<div class="center">中间</div>
<div class="right">右边</div>
</div>
</body>
</html>