双飞翼布局 #
- 圣杯布局的改良版
- 去掉了相对布局,只需要浮动和负边距
示例代码 #
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>双飞翼布局</title>
<style>
*{
margin: 0;
padding: 0;
}
.main,.left,.right{
float:left;
height:300px;
}
.main{
width:100%;
}
.main .main-inner{
background-color: red;
margin-left:200px;
margin-right:220px;
height:300px;
}
.left{
width:200px;
background-color: yellow;
margin-left:-100%;
}
.right{
width:220px;
background-color: blue;
margin-left:-220px;
}
</style>
</head>
<body>
<div class="main">
<div class="main-inner">
主体
</div>
</div>
<div class="left">left</div>
<div class="right">right</div>
</body>
</html>