html - 没有此代码,Fontawesome 将无法工作
问题描述
每次我想使用 fontawesome 时,我都必须将此样式添加到页面中:
<style>
* {
font-family: fontawesome !important;
}
</style>
如果不是它只显示一个空白方块,但这样做我不能使用另一种字体,我可以使用 fontawesone 但不必定义它的任何解决方案?
解决方案
这个解决方案是关于 Font Awesome 5 的。有两种应用字体真棒图标的方法。在下面的片段中,我已经展示了它们。您需要链接字体真棒新库,否则将无法正常工作。
.fa {
font-family: "Font Awesome 5 Free"; /* updated font-family */
font-weight: 900; /* regular style/weight */
}
.my-camera::before {
font-family: "Font Awesome 5 Free"; /* updated font-family */
font-weight: 900; /* regular style/weight */
content: "\f083";
font-style:normal;
}
<link href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" rel="stylesheet"/>
<i class="fas fa-camera-retro"></i> <!-- version 5's syntax -->
<br>
<i class="my-camera"></i> <!-- version 5's syntax -->
推荐阅读
- angular - Angular 10 路径别名问题
- javascript - 在 SharePoint 中呈现列表
- python - 为什么 module.__file__ 返回无?
- flutter - 如何扩展 TextInputFormatter 以将数字范围和格式限制为 1 个小数位 ("000.0") 。在颤振中
- python - 龙卷风:初始化()和准备()之间的区别
- python - 在 mac os 和 python 中设置 SIGKILL 处理程序时出现 OSError
- c# - 如何通过cmd运行多个specflow项目?
- ios - 带有 Firebase iOS 云消息通知的 Amazon SNS 不起作用
- amazon-s3 - 公开 AWS CodeBuild 工件
- python - 根据另一列中的 ID 列表替换一列的值