calc实现
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
}
.wrap{
width: 100%;
height: 100%;
}
.left,.right{
width: 100px;
height: 100vh;
background: red;
float: left;
}
.center{
width: calc(100% - 200px);
height: 100vh;
background: blue;
float: left;
}
</style>
</head>
<body>
<div class="wrap">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
</body>
</html>
flex实现
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
}
.wrap{
display: flex;
}
.left,.right{
flex: 0 0 100px;
height: 100vh;
background: red;
}
.center{
flex: 1 1 auto;
height: 100vh;
background: blue;
}
</style>
</head>
<body>
<div class="wrap">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
</body>
</html>