【发布时间】:2020-03-21 03:37:50
【问题描述】:
尝试用 Font Awesome 图标替换列表项标签上的项目符号类型,但我得到一个空方块:
ul {
list-style: none;
}
.testitems {
line-height: 2em;
}
.testitems:before {
font-family: "Font Awesome 5 Free";
content: "\f058";
margin: 0 5px 0 -15px;
color: #004d00;
display: inline-block;
}
<script src="https://use.fontawesome.com/releases/v5.12.0/js/all.js"></script>
<ul>
<li class="testitems">List Item 1</li>
<li class="testitems">List Item 2</li>
<li class="testitems">List Item 3</li>
<li class="testitems">List Item 4</li>
<li class="testitems">List Item 5</li>
</ul>
我知道字体库正在加载,因为我能够使用<i class="fas fa-check-circle"></i><li class="testitems">List Item 1</li> 并且字体正确呈现(尽管样式不正确)。
【问题讨论】:
-
是的!加载 JS 版本。将 DL CSS 版本并试一试。感谢您的提示。
-
Temani - 不知道你最后的评论是什么意思。
标签: css font-awesome font-awesome-5