Help us understand the problem. What is going on with this article?

雑書きメモ:自サイト以外のリンクにFont awesomeを反映させたかった話

More than 1 year has passed since last update.

やりたかったこと

  • いまサイト作ってる
  • 自サイト以外のリンクのとき、Font awesomeアイコンが自動でくっつくようにしたい

つまづいたこと

  • URLだけを除外すると、別のいらんところ(例えばTwitterのシェアボタン)にまで反映される
  • 別タブが開かないページを除外すると、それもいらんところがガンガン反映されてる

結果的に

2つをくっつけて乗り切りました。

style.css
a:not([target="_blank"]):not([href^="https://hogehoge.com/"]) {
    position: relative!important;
}

a:not([target="_blank"]):not([href^="https://hogehoge.com/"]):after {
    content: "\f35d";
    color: #333;
    font-family: "Font awesome 5 Free";
    width:20px;
    height:20px;
    padding-left:0.3em;

    font-weight:900;
}

:not([target="_blank"])で「ページ内リンクを除外」、not([href^="https://hogehoge.com/"])で「自サイトのリンクを除外」しています。たぶん。
あってる?あってるよね??

まとめ

CSS、奥が深いぜ…

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away