双飞翼布局实现中间自适应,两边固定宽度的三列布局。
代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
*{
padding:0;
margin:0;
}
header,footer{
width: 100%;
height: 40px;
background-color: palegreen;
}
.main{
overflow: hidden;
/* padding: 0 200px;*/
}
.main .middle {
width: 100%;
height: 100px;
background-color: antiquewhite;
float: left;
}
.left {
margin-left: -100%;
width: 200px;
height: 100px;
background-color: paleturquoise;
float: left;
/* position: relative;
left: -200px;*/
}
.right {
margin-left: -200px;
width: 200px;
height: 100px;
float: left;
background-color: lightblue;
/* position: relative;
right: -200px;*/
}
.middle-inner
{
margin-left: 200px;
margin-right: 200px;
}
</style>
</head>
<body>
<header>header</header>
<div class = "main">
<div class = "middle">
<div class = "middle-inner">inner</div>
</div>
<div class = "left">left</div>
<div class = "right">right</div>
</div>
<footer>footer</footer>
</body>
</html>