LoginSignup
2
1

More than 5 years have passed since last update.

Font Awesome 5 を擬似要素で使う

Last updated at Posted at 2018-02-21

推奨のSVG with JSは手軽で便利だけれど、擬似要素で使うのがすこし面倒なのと、表示スピードがやや遅いので、Web Fonts with CSSを使うことが多い。

Freeを擬似要素で使うときには、
https://use.fontawesome.com/releases/v5.0.6/css/all.css
の中にある

-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1

に加えて、

content: '\f138';
font-family: 'Font Awesome\ 5 Free';
font-weight: 900;

の3行を擬似要素に指定しなければならない。
freeはfont-weightが900しかないのでこれを指定しないとフォントが表示されない。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1