css - 在字体真棒图标之后更改字体系列
问题描述
我正在使用字体真棒图标构建一个网站,我注意到当我使用图标时字体系列会发生变化。
我已经在网上阅读了有关伪元素的信息,但无法弄清楚。
在使用字体真棒图标后,有什么方法(代码示例)可以用来继承网站中使用的相同字体系列?
非常感谢!
<script src="https://use.fontawesome.com/cce2885033.js"></script>
<br><i class="fa fa-check"> If the athlete does not have time and has to eat 1 hour before the game, 70g are usually enough.</i><br>
解决方案
Font-Awesome 应用了自己的字体系列。像这样使用它:
<i class="fa fa-check"></i><p style="font-family:'yourfont';">TEXT</p>
或者在 css 中使用伪元素 ::before 将 font-awesome 图标应用到没有图标标签的文本的左侧(之前):
p::before {
font-family: "Font Awesome\ 5 Free";
display: inline-block;
padding-right: 3px;
font-weight: 900;
content: "\f00c";
}
推荐阅读
- dictionary - 如何在python中删除字典中的空格?
- node.js - 使用 loopback v4 时如何设置 mongodb 集合名称?
- python - 如何从具有不同参数的方法列表中随机选择方法?
- excel - 如何按索引访问`.Range`对象项?
- java - 查看 JSP 站点中的时间戳是否超过 24 小时
- python - 标准化大量数值数据以创建有价值的线图
- python - 如何让客户端(例如浏览器)使用 python 通过 UDP 和 TCP 请求一些资源
- reactjs - 通过将其解析为标志来运行带有纱线的可选脚本
- reactjs - React -> React Boilerplate: 上面的错误发生在
零件: - javascript - 数据表删除行删除多行