1.float+margin(自适应的那个元素),适应横向布局
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>左中右三列 左右固定200px 中间自适应占满</title>
<style>
body {
margin: 0;
height: 100%;
padding: 0;
font-size: 30px;
font-weight: 500;
text-align: center;
}
.left {
width: 200px;
height: 500px;
background-color: red;
float: left;
}
.right {
width: 200px;
height: 500px;
background-color: #00f;
float: right;
}
.zhong {
height: 500px;
margin: 0 200px;
background-color: #f0f;
}
</style>
</head>
<body>
<div class="left"></div>
<div class="right"></div>
<div class="zhong"></div>
</body>
</html>
2.float+绝对定位(自适应的那个元素),适应横向布局
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>左中右三列 左右固定200px 中间自适应占满</title>
<style>
body {
margin: 0;
height: 100%;
padding: 0;
font-size: 30px;
font-weight: 500;
text-align: center;
}
.left {
width: 200px;
height: 500px;
background-color: red;
float: left;
}