前端字体图标使用

阿里的字体图标库:https://www.iconfont.cn/

在里面下载图标对应的源码解压后有6个文件在这里插入图片描述dome.css:里面是demo_index.html的样式
demo_index.html:有字体使用的说明
iconfont.css:使用css来引用字体图标
iconfont.js:使用js进行引用方式字体图标
iconfont.json:这面写个每一个字体图标的JSON的数据格式
iconfontt.tth:是字体图标的实现,前面css后js文件都是引用

使用字体图标的方式:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 方式1和2都需要引入的css文件 -->
    <link rel="stylesheet" href="static/font/iconfont.css">
	<!-- 方式3:引入js文件 -->
    <script src="static/font/iconfont.js"></script>
    <!-- 方式3:加载这一段代码对字体样式进行初始化,添不添加都可以 -->
    <style>
        .icon {
            width: 1em;
            height: 1em;
            vertical-align: -0.15em;
            fill: currentColor;
            overflow: hidden;
        }
    </style>
</head>
<body>
<!-- 方式1:使用字体的统一码,在iconfont_index.html中有提供 -->
<span class="iconfont">&#xe60b;</span>

<!-- 方式2:使用字体类进行使用,同样在iconfont_index.html中有提供 -->
<span class="iconfont icon-dui"></span>

<!-- 方式3:js方式进行引用 -->
<svg class="icon" aria-hidden="true">
	<use xlink:href="#icon-cha"></use>
</svg>

</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值