css用clearfix清除浮动实例
/*所有主流浏览器都支持 :after 伪元素。*/
/*.clearfix:after{content:”.”;display:block;height:0;clear:both;visibility:hidden}
.clearfix{*+height:1%;}/*不知道有什么用处,不加ie7也没有问题*/ */
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: block;
line-height: 0;
content: “”;
}
.clearfix:after {
clear: both;
}
.box{ background:#f00;width:500px; position:relative;}
.l{float:left; background:#333;width:200px; height:100px;}
.r{float:right;background:#666;width:200px; height:200px;opacity: 0.5;}
.s{width:100px; height:100px;background:#999;position:absolute;right:-50px;;}
left
right
absolute