アイコンを追加する方法

HTML ページにアイコンを追加する最も簡単な方法は、Font Awesome などのアイコン ライブラリを使用することです。

指定されたアイコン クラスの名前をインライン HTML 要素 (<i> や <span> など) に追加します。

以下のアイコン ギャラリー内のすべてのアイコンはスケーラブルなベクターであり、CSS (サイズ、色、影など) を使用してカスタマイズできます。

Font Awesome アイコン

Font Awesome アイコンを使用するには、fontawesome.com にアクセスしてログインし、HTML ページの <head> セクションに追加するコードを取得します。

<script src="https://kit.fontawesome.com/yourcode.js"></script>

Font Awesome の使用を開始する方法について詳しくは、Font Awesome 5 チュートリアルをご覧ください。

ヒント: ダウンロードやインストールは必要ありません。

<!DOCTYPE html>
<html>
<head>
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
</head>
<body>

<i class="fas fa-cloud"></i>
<i class="fas fa-heart"></i>
<i class="fas fa-car"></i>
<i class="fas fa-file"></i>
<i class="fas fa-bars"></i>

</body>
</html>

结果:

自分で試してみてください

Bootstrap アイコン

Bootstrap glyphicons を使用するには、HTML ページの <head> セクション内に次の行を追加します。

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

ヒント: ダウンロードやインストールは必要ありません。

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>

<i class="glyphicon glyphicon-cloud"></i>
<i class="glyphicon glyphicon-remove"></i>
<i class="glyphicon glyphicon-user"></i>
<i class="glyphicon glyphicon-envelope"></i>
<i class="glyphicon glyphicon-thumbs-up"></i>

</body>
</html>

結果:

自分で試してみてください

Google アイコン

Google アイコンを使用するには、HTML ページの <head> セクションに次の行を追加します。

<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

ヒント: ダウンロードやインストールは必要ありません。

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>

<i class="material-icons">cloud</i>
<i class="material-icons">favorite</i>
<i class="material-icons">attachment</i>
<i class="material-icons">computer</i>
<i class="material-icons">traffic</i>

</body>
</html>

结果:

自分で試してみてください