清除浮动:
1.给父元素添加 clear:both;
2.在浮动元素后面添加一共空白元素:
<div style="clear:both;"></div>
3.给父元素添加 overflow:hidden/auto;
4.添加给父元素添加after伪元素:
.content:after{ content:"."; display:block; height:0; visibility:hidden; clear:both; } .content{zoom:1;}
让宽带width包含内边距和边框:
.box{ box-sizing: border-box; }
让文字居中显示
.text{ text-align: center;/*水平居中*/ ine-height: 30px;/*设置和容器一页靠度-垂直居中*/ }