2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【CSS】複数の要素に対して同じCSSを指定

Posted at
スクリーンショット 2019-12-28 2.25.48.png
例.html
<h1>文字赤くしてー</h1>
<p>ここも赤くしてー</p>

このような場合、CSSでは

例.css
h1 {
  color: red;
}
p {
  color: red;
}

このように記入しなければならなかった。
もちろんこれでも間違いではないのだけど
h1 も p も同じ内容。
こういうときは・・・

例.css
h1,p {
  color: red;
}

h1 と p のあいだを , で区切って記入しても・・・

Web

スクリーンショット 2019-12-28 2.25.48.png

同じ表示:laughing:
コードも見やすくなりました:laughing:

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?