1.双飞翼布局
div:
<div id="cont">
<div class="center">111</div>
</div>
<div class="left"></div>
<div class="right"></div>
css:
#cont{
padding-left:200px;
padding-right:150px;
background: #eeeeee;
}
.left{
height: 100px;
background: red;
float: left;
width: 200px;
margin-left:-200px
}
.center{
height: 100px;
background: yellow;
width: 100%;
float: left;
}
.right{
height: 100px;
background:blue;
float: left;
width: 150px;
margin-right:-150px;
}
2.圣杯布局
其实跟双飞翼布局大同小异
<div id="cont">
<div class="left"></div>
<div class="center">111</div>
<div class="right"></div>
</div>
left用到了
position: relative;
right: 200px;
3. 使用calc()
个人比较喜欢用这个 方便简洁!!!!
{
float: left;
}
#center {
margin-left: 200px;
margin-right: 150px;
width: calc(100% - 350px);
}
**
4. 使用border-box
**
没怎么用过也可以实现
5.使用flex
http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html(转载的)