示例:
.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