解决css字体图标如何下载使用

步骤一:建立一个文件夹,因为文件有点多,怕搞乱
然后里面建立一个html文件。我建立的名字是iconfont.html。如下图:
在这里插入图片描述
步骤二:从网上下载字体图标。http://icomoon.io(免费的)
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
步骤三:将文件解压到和你html文件相同级上,如下图(另外这些都是解压出来的文件文件夹):
在这里插入图片描述
步骤四:用记事本的方式打开style.css的内容,复制一下内容:
在这里插入图片描述
步骤五:粘贴到html的style样式里面,如下图:
在这里插入图片描述
步骤六:打开文件夹里面的如下网页,因为我们下载的字体图标都在里面:
在这里插入图片描述
步骤七:将你想要放在网页的图标右边这个小长方形复制一下,我就随便,弄第一个试试。
在这里插入图片描述
代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        @font-face {
  font-family: 'icomoon';
  src:  url('fonts/icomoon.eot?ltta21');
  src:  url('fonts/icomoon.eot?ltta21#iefix') format('embedded-opentype'),
    url('fonts/icomoon.ttf?ltta21') format('truetype'),
    url('fonts/icomoon.woff?ltta21') format('woff'),
    url('fonts/icomoon.svg?ltta21#icomoon') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
.div {
    font-family: 'icomoon';
}
    </style>
</head>
<body>
    <!-- 将复制的字体图标缩减版粘贴在如下 -->
    <div class="div"></div>
</body>
</html>

运行结果如下:
在这里插入图片描述
字体图标本质是字体,因此我们还能设置字体拥有的属性,例如:
代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        @font-face {
  font-family: 'icomoon';
  src:  url('fonts/icomoon.eot?ltta21');
  src:  url('fonts/icomoon.eot?ltta21#iefix') format('embedded-opentype'),
    url('fonts/icomoon.ttf?ltta21') format('truetype'),
    url('fonts/icomoon.woff?ltta21') format('woff'),
    url('fonts/icomoon.svg?ltta21#icomoon') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
.div {
    font-family: 'icomoon';
    font-size: 100px;
    color: aqua;
    text-align: center;
}
    </style>
</head>
<body>
    <!-- 将复制的字体图标缩减版粘贴在如下 -->
    <div class="div"></div>
</body>
</html>

变大变颜色试试:
在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值