<!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>
* {
margin: 0;
padding: 0;
}
.box {
height: 500px;
background-color: chartreuse;
display: flex;
}
.box p:nth-child(1),
.box p:nth-child(3) {
width: 200px;
height: 480px;
background-color: red;
}
.box p:nth-child(2) {
/* 中间剩余空间分配 */
flex: 1;
height: 480px;
background-color: green;
}
</style>
</head>
<body>
<div class="box">
<p>左边</p>
<p>中间</p>
<p>右边</p>
</div>
</body>
</html>