1、如何清除浮动 方法1:
#test{clear:both;} 方法2:
#test{display:block;zoom:1;overflow:hidden;} 方法3:
#test{zoom:1;} #test:after{display:block;clear:both;visibility:hidden;height:0;content:'';} 2、如何让未知尺寸的图片在已知宽高的容器内水平垂直居中?
#test{display:table-cell;*display:block;*position:relative;width:200px;height:200px;text-align:center;vertical-align:middle;} #test p{*position:absolute;*top:50%;*left:50%;margin:0;} #test p img{*position:relative;*top:-50%;*left:-50%;vertical-align:middle;} |