Font Awesome 5 star icon has <i class="fas fa-star"></i>
and <i class="far fa-star"></i>
different is fas , far
and Unicode for both is f005
now i want to use it as my评级系统首先是普通星,然后通过点击变成实心星,但是我如何在我的 CSS 中定义这个 fas
far
?
代码
input.star:checked ~ label.star:before {
content: '\f005';
color: #e74c3c;
transition: all .25s;
font-family: 'Font Awesome 5 Free';
font-weight: 900;
}
label.star:before {
content: '\f005';
font-family: 'Font Awesome 5 Free';
font-weight: 900;
}
使用上面的代码,我只能得到实心星
原文由 mafortis 发布,翻译遵循 CC BY-SA 4.0 许可协议
如果您使用的是 JS+SVG 版本,请阅读: Font Awesome 5 shows empty square when using the JS+SVG version
普通 版和 实体 版的区别在于
font-weight
。您只需要调整这个即可在两个版本之间进行交换:这是另一个相关问题 Font Awesome 5 on pseudo elements shows square 而不是 icon 以获取更多详细信息。