LoginSignup
2
3

More than 3 years have passed since last update.

fontAwesomeのアイコンにバッジをつける方法

Posted at

スクリーンショット 2019-05-28 10.30.57.png
通知があった時に右上に通知マークを表示するカスタマイズについて。

<i class="fas fa-bell badge"></i>

badgeというclassを設定します。

あとはCSSを追加。

css
.fa-bell{
  position: relative;
}

.badge:after{
  content:"";
  position: absolute;
  background: #fff;
  height:6px;
  width:6px;
  top:-2px;
  right:-5px;
  text-align: center;
  border-radius: 50%;
  color:white;
}

通知があった時だけ、badgeを追加すればいいですね。

2
3
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
3