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

CSSセレクタの詳細度 (優先順位)

More than 1 year has passed since last update.



CSSセレクタの優先順位 (強さ順)

  1. HTMLのstyle属性
  2. id
  3. class、擬似クラス、属性
  4. 要素型、擬似要素

⚠️ 同じ優先順位の場合は後に書いたCSSが優先される。

  <div class="red">
.red {
  color: red;
div {
  color: black;

スクリーンショット 2019-11-12 17.38.46.png


Why not register and get more from Qiita?
  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