回答編集履歴

1

コード追記

2020/12/07 00:50

投稿

hatena19
hatena19

スコア33773

test CHANGED
@@ -1,10 +1,8 @@
1
- notで`.label`を除外すると考えるより、`.label`の[詳細度](https://developer.mozilla.org/ja/docs/Web/CSS/Specificity)上げると考えた方が分かり安いと思います。
1
+ `:not`で`.label`を除外すると考えるより、`.label`の[詳細度](https://developer.mozilla.org/ja/docs/Web/CSS/Specificity)上げると考えた方が分かり安いと思います。
2
2
 
3
3
 
4
4
 
5
5
  例えば、
6
-
7
-
8
6
 
9
7
  ```css
10
8
 
@@ -25,3 +23,25 @@
25
23
  }
26
24
 
27
25
  ```
26
+
27
+ `:not` を使うなら、
28
+
29
+ ```css
30
+
31
+ .div-link > .link{
32
+
33
+ text-decoration: none;
34
+
35
+ color: #333;
36
+
37
+ & .label {background-color: fuchsia; }
38
+
39
+ & :not(.label):focus,:not(.label):hover {
40
+
41
+ background-color: $backColor;
42
+
43
+ }
44
+
45
+ }
46
+
47
+ ```