首页 > 代码库 > 左右定宽中间自适应布局

左右定宽中间自适应布局

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}

.left {
float: left;
width: 200px;
height: 200px;
background-color: red;
margin-right: -200px;
}

.middle {
float: left;
width: 100%;
}

.middle-content {
height: 200px;
margin-left: 200px;
margin-right: 200px;
background-color: yellow;
}

.right {
float: right;
width: 200px;
height: 200px;
background-color: blue;
margin-left: -200px;
}
</style>
</head>

<body>
<div class="left"></div>
<div class="middle">
<div class="middle-content"></div>
</div>
<div class="right"></div>
</body>

</html>

左右定宽中间自适应布局