圣杯布局
css
<style>
* {
margin: 0;
padding: 0;
}
.container {
width: calc(100% - 300px);
padding: 0 150px;
height: 300px;
background: red;
}
.fl {
float: left;
}
.center {
width: 100%;
height: 300px;
background: aqua;
}
.left {
width: 150px;
height: 300px;
background-color: #1a1aff;
margin-left: -100%;
position: relative;
left: -150px;
}
.right {
width: 150px;
margin-right:-150px ;
height: 300px;
background-color: #ff2bd1;
}
</style>
html
<div class="container">
<div class="center fl"></div>
<div class="left fl"></div>
<div class="right fl"></div>
<div style="clear: both"></div>
</div>
双飞翼布局
css
<style>
body {
min-width: 500px;
}
#container {
width: 100%;
}
.fl {
float: left;
}
#center {
margin-left: 200px;
margin-right: 150px;
background-color: #ff5c3c;
}
#left {
width: 200px;
margin-left: -100%;
background-color: #95ff3f;
}
#right {
width: 150px;
margin-left: -150px;
}
#footer {
clear: both;
}
</style>
html
<div id="header"></div>
<div id="container" class="fl">
<div id="center">123</div>
</div>
<div id="left" class="fl">123</div>
<div id="right" class="fl">123</div>
<div id="footer"></div>