1
0

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 3 years have passed since last update.

セレクタを並べて記述【CSS】対象を絞り込む

Last updated at Posted at 2022-03-26

HTML

<p class="item _current">サンプル1</p>
<p class="item">サンプル2</p>

CSS

.item._current { color: red; }

.item { font-style: italic; }

スクリーンショット 2022-03-26 10.39.39.png

セレクタを区切り文字・空白なしで記述(結合・連結)すると、対象を絞り込むことができる。

例:クラスセレクタ「item」とクラスセレクタ「_current」を並べて、「サンプル1」だけを赤文字にしている。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?