如何将 Font Awesome 图标嵌入到外部 CSS 样式表中。
对于 Font Awesome 5 和免费图标 ---
#preview .buttons .ok {
border: 1px solid #F5F5F5;
border-radius: 4px;
width: 28px;
height: 28px;
font-size: 20px;
}
.ok:before {
content: "\e900";
display: inline-block;
font-family: "Font Awesome 5 Free";
font-weight: 700;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transform: translate(0, 0);
}
现在尝试一下..
最佳答案
\e900
不存在于 font Awesome 的图标中...
它与其他(例如 \f2b9
)配合良好
查看此处的图标并将 unicode 复制到 css : https://fontawesome.com/icons?d=gallery
并将如下链接放入您的 head
标记中
#preview .buttons .ok {
border: 1px solid #F5F5F5;
border-radius: 4px;
width: 28px;
height: 28px;
font-size: 20px;
}
.ok:before {
content: "\f2b9";
display: inline-block;
font-family: "Font Awesome 5 Free";
font-weight: 900;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transform: translate(0, 0);
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.1/css/all.css" integrity="sha384-O8whS3fhG2OnA5Kas0Y9l3cfpmYjapjI0E4theH4iuMD+pLhbf6JI0jIMfYcK3yZ" crossorigin="anonymous">
<div id='preview'>
<div class='buttons'>
<div class='ok'></div>
</div>
</div>
关于html - 将很棒的字体图标嵌入到外部 css 文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51399884/