CSS伪元素:before/CSS伪元素:before/:after content 显示Font Awesome字体图标:after content 显示Font Awesome字体图标

时间:2024-12-18 08:36:56

HTML

<a href="javascript:volid(0);"><i class="icon-table"></i>表格</a> 

CSS

input[type="radio"]:checked + label:before {
content: "\e659"; // iconfont格式,打开iconfont.css文件里面可以找到
position: absolute;
left: 31px;
top: 2px;
font-family: "iconfont" !important; // 一定要设置font-family:“iconfont”不然字体无法出来
color: #2070F7;
font-size: 14px;
line-height: 42px;
}

  

控制台查看:

CSS伪元素:before/CSS伪元素:before/:after content 显示Font Awesome字体图标:after content 显示Font Awesome字体图标