<header><h4>Header内容区</h4></header>
<div class="container">
<div class="middle"><h4>中间弹性区</h4></div>
<div class="left"><h4>左边栏</h4></div>
<div class="right"><h4>右边栏</h4></div>
</div>
<footer><h4>Footer内容区</h4></footer>
.header {
width: 100%;
height: 100px;
background-color: darkseagreen;
}
.footer {
width: 100%;
height: 30px;
background-color: darkslategray;
}
.container {
height: 200px;
padding: 0 100px 0 50px;
overflow: hidden;
background-color: rgb(242, 245, 241);
}
.left,
.middle,
.right {
position: relative;
float: left;
height: 100px;
}
.middle {
width: 100%;
background-color: rgb(161, 25, 43);
}
.left {
width: 50px;
background-color: rgb(68, 156, 28);
}
.right {
width: 100px;
background-color: rgb(25, 39, 161);
}
.left {
width: 50px;
left: -50px;
background-color: rgb(68, 156, 28);
}
.right {
width: 100px;
margin-left: -100px;
right: -100px;
background-color: rgb(25, 39, 161);
}
.container{ padding: 0 200px;}
.left{ position: relative; left: -200px;}
.right{position: relative;right: -210px;}
<div class="header"></div>
<div class="container">
<div class="middle">
<div id="main-content">
<h4>中间弹性区</h4>
</div>
</div>
<div class="left">
<h4>左边栏</h4>
</div>
<div class="right">
<h4>右边栏</h4>
</div>
</div>
<div class="footer"></div>
</div>
.middle {
width: 100%;
background-color: rgb(224, 41, 185);
}
.main-content {
margin: 0 100px 0 50px;
}
.left,
.middle,
.right {
float: left;
height: 100px;
}
.left {
width: 50px;
margin-left: -100%;
background-color: rgb(68, 156, 28);
}
.right {
width: 100px;
margin-left: -100px;
background-color: rgb(25, 39, 161);
}
双飞翼是淘宝 UED 发明的. 区别在于使用的是 margin 还是 padding. 1.双飞翼布局不用设置相对布局,以及对应的 left 和 right 值 2. 双飞翼布局给主面板添加了一个父标签用来通过 margin 给子面板腾出空间