css 伪元素分享!!!

最近接触到的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的属性

原文地址:https://www.cnblogs.com/ninali/p/3569717.html