示例:
.bottom {
height: 40px;
line-height: 40px;
text-align: center;
background-color: #ccc;
#margin-top: 100px;
#clear: both;
#float: left; /*父元素float,子元素text-align: center;無效,解決將子元素設爲浮動或者清除浮動*/
#width: 100%;
}
清除浮動示例:
.box:after {
content: "";
height: 0;
display: block;
visibility: hidden;
clear: both;
}
.box {
zoom: 1; //after僞類,觸發IE下haslayout,使元素根據自身內容計算寬高,它的效果和height:1%一樣。
}
清除浮動參考文章:
https://www.cnblogs.com/fanyj/p/4431737.html