最近接觸到的css 偽元素覺得還算不錯 分享下:
1、清楚內盒浮動設置:
.back_list ul{padding:12px 0 0 12px;zoom:1;} .back_list ul:after{clear: both;content: ".";display: block;height: 0;visibility: hidden;}/*清楚內盒浮動設置*/
?
2、偽元素after設置,在元素之后添加內容:
.afterxx{width:400px;height:200px; background-color:#999;border-radius:10px;margin:50px;position:relative;} .afterxx:after{color:#999;font-size:94px;content:"?";position:absolute;left:-23px;top:16%;}
?
3、偽元素before設置,在元素之前添加內容:
.beforexx{width:300px;height:100px;} .beforexx:before{content:url(back_listimg.jpg);}
?
注:IE8版本以下不支持標注2和3的屬性
?