2
1

More than 1 year has passed since last update.

CDNでFont Awesome 6をで利用する

Last updated at Posted at 2022-10-13

はじめに

HTML/CSSでアイコンを使用したかったのでFont Awesomeを初めて使用しました。
バージョン違いで戸惑ったので、CDNでFont Awesome 6を利用する方法を備忘録として残しておきます。

Font AwesomeのCDN

以下のコードをHTMLファイルの<head></head>内に記載する。(Ver.6.2.0)

<link href="https://use.fontawesome.com/releases/v6.2.0/css/all.css" rel="stylesheet">

Font Awesomeの現在のバージョンは、公式サイト内(下記画像参照)で確認できる。
FontAwesome_ver.png

基本的なアイコンの利用方法

公式サイトから使いたいアイコンのコードをコピーする。
https://fontawesome.com/
FontAwesome_icon.png

コピーしたコードはHTMLファイルに貼り付ける。

index.html
<body>
  <i class="fa-solid fa-house"></i>      
</body>

バージョンが異なるとアイコンが表示されないことがある。
防ぐにはCDNのv6.2.0の部分と同じバージョンのアイコンを検索する必要がある。
FontAwesome_ver2.png

参考

https://giga-log.com/fontawesome-not-displayed/

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