如何让Iconfont做用到content伪类中

沿用同行思密达的方法整理了一下;前提是先引入iconfont字体图标(引用线上iconfont查看上篇随笔):好比 其中&#是开头用以标明这是字符实体,x表示这是十六进制,而CSS的content接受的也是16进制的Unicode编码,因此能够直接写 content: "\e7bb";css

别忘记把font-family:"iconfont"写进去,很重要的字体

<style typel="text/css">
    .show:before{
    font-family: "iconfont";
    content: "\eae2";
    color: red;
    width: 20px;
    height: 20px;
    position: absolute;
    left: 5%;
    }
</style>
<div class="show"></div>
相关文章
相关标签/搜索