1. main模塊最早加載
2. main模塊寬度佔滿父容器
3. main模塊浮動,left、right模塊居左右
複製代碼
<header>聖盃佈局</header>
<div class="content clearfix">
<div class="main text">main</div>
<div class="left text">left</div>
<div class="right text">right</div>
</div>
<footer>footer</footer>
複製代碼
.main {
float: left;
width: 100%;
height: 200px;
background: #000;
}
複製代碼
.left {
float: left;
width: 200px;
height: 200px;
background: pink;
position: relative;
left: -200px;
margin-left: -100%;
}
複製代碼
.right {
float: left;
width: 200px;
height: 200px;
background-color: #4ddef1;
margin-left: -200px;
position: relative;
left: 200px;
}
複製代碼
.clearfix::after {
content: "";
display: table;
clear: both;
}
複製代碼
####### 清浮目前業內有五種方法(我我的以爲能夠算是三種,由於13均是clear:both;只不過利用了僞元素等特性簡化了一下而已;25均是觸發BFC)bash