Understanding CSS .selector.selector Syntax

Ole Ersoy
May 29, 2022

--

Image by Rudy and Peter Skitterians from Pixabay

Scenario

We have a CSS rule.

.name1.name2 {
color:red;
}

And we are wondering what the selector .name1.name2 selects.

Approach

It will select elements with both class names, so for this example Hello there! will be red.

<h1 class="name1 name2">Hello there!</h1>

Demo

Additional Concepts

--

--

Ole Ersoy

Founder of Firefly Semantics Corporation