LoginSignup
8
4

More than 5 years have passed since last update.

CSS セレクターで〈特定の属性を持たない〉をどう表すか

Posted at

href を持たない a 要素にスタイルを適用したかったのですが,セレクターをどう書けばいいか,すぐには分かりませんでした。

属性セレクターの一覧 をじーっと見ても載ってない。

not を使えばいいんですね。

a:not([href]) {
  opacity: 0.7;
}
8
4
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
8
4