質問するログイン新規登録

回答編集履歴

3

アンダーバーをハイフンに修正しました。

2018/02/12 14:56

投稿

EBOOT.PBP
EBOOT.PBP

スコア20

answer CHANGED
@@ -23,15 +23,15 @@
23
23
  除外するものが多い場合は、普通にclassで指定するのが効率が良いと思います。
24
24
  CSS
25
25
  ```
26
- .color_red{
26
+ .iro-aka{
27
27
  color:red;
28
28
  }
29
29
  ```
30
30
  HTML
31
31
  ```
32
32
  <div id="pr">
33
- <p class="color_red">hello</p>
33
+ <p class="iro-aka">hello</p>
34
- <b class="color_red">world</b>
34
+ <b class="iro-aka">world</b>
35
35
  </div>
36
36
  ```
37
37
 
@@ -51,4 +51,5 @@
51
51
  </div>
52
52
  ```
53
53
  でもあまり、効率がいいとは思いません。
54
- 参考までにどうぞ。
54
+ 参考までにどうぞ。
55
+ _(アンダーバー)はgoogleで推奨していないので-(ハイフン)に修正しました。

2

誤字修正しました。

2018/02/12 14:56

投稿

EBOOT.PBP
EBOOT.PBP

スコア20

answer CHANGED
@@ -31,7 +31,7 @@
31
31
  ```
32
32
  <div id="pr">
33
33
  <p class="color_red">hello</p>
34
- <b class="color_red">>world</b>
34
+ <b class="color_red">world</b>
35
35
  </div>
36
36
  ```
37
37
 

1

試行錯誤してより良い方法を書いてみました。

2018/02/10 02:56

投稿

EBOOT.PBP
EBOOT.PBP

スコア20

answer CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [CSSで#wrapper img,#wrapper pというような途中までの指定タグが同じで複数タグを指定する場合のスマートな書き方はありますか?](https://teratail.com/questions/112459)
4
4
 
5
- 無理矢理CSSでやるのでしたら、
5
+ 無理矢理CSSでやるのでしたら、除外するものが少ない場合、
6
6
  CSS
7
7
  ```
8
8
  #pr>*:not(.jogai){
@@ -20,6 +20,21 @@
20
20
  <b class="jogai">yatta!</b>
21
21
  </div>
22
22
  ```
23
+ 除外するものが多い場合は、普通にclassで指定するのが効率が良いと思います。
24
+ CSS
25
+ ```
26
+ .color_red{
27
+ color:red;
28
+ }
29
+ ```
30
+ HTML
31
+ ```
32
+ <div id="pr">
33
+ <p class="color_red">hello</p>
34
+ <b class="color_red">>world</b>
35
+ </div>
36
+ ```
37
+
23
38
  もし、pタグとbタグしかなく、順番がpタグとbタグ共に一番目なら、こちらが使えると思います。
24
39
  IE11しか確認してませんが、できます。
25
40
  CSS