How would you chain two class selectors together?


#1

In this exercise CSS 1|12 we learnt how to chain a name tag and a class. I’m wondering how would you chain two class selectors e.g. chaining .green and .cursive together?

Would it be .green cursive or .green.cursive?


#2
.green .cursive {
color: Green;
font-family: cursive;
}

#3

This is not chaining, but descendant. It matches any cursive class that is a descendant of a green class.

<div class="green">
  <div class="cursive">

  </div>
</div>

To have a selector match an element that is both green AND cursive we literally do chain them…

.green.cursive {}

with no whitespace separating them.

<div class="green cursive">

</div>

#4

That makes sense. Never had to chain selectors before.