我在
添加为元素的相同图标在两个浏览器中均正确呈现。
这里是小提琴:JS Fiddle
ul li {
list-style: none;
}
ul li:before {
margin-right: 10px;
font-family: 'Font Awesome 5 Pro Solid';
content: '\f0c8';
color: "#cc0000";
}
是否有解决方法可以在Chrome中显示图标?
您的jsfiddle指定了不正确的font-family
。正确的是Font Awesome 5 Free
(用于您使用的CDN字体链接)。
此外,您还必须将font-weight: 900
设置为粗体。
ul li {
list-style: none;
}
ul li:before {
margin-right: 10px;
font-family: 'Font Awesome 5 Free';
font-weight: 900;
content: '\f0c8';
color: #c00;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" rel="stylesheet"/>
As a list bullet (li:before) Firefox (v74) shows correct full square icon, Chrome (v80) shows an outlined square like missing character.
<ul>
<li>Bullet 1</li>
<li>Bullet 2</li>
</ul>
Inserted as 'normal' <i> element, the icon shows in both browsers: <i class="fas fa-square"></i>