CSS Selector “(A or B) and C”?

This should be simple, but I’m having trouble finding the search terms for it.
Let’s say I have this:

<div class="a c">Foo</div>
<div class="b c">Bar</div>

In CSS, how can I create a selector that matches something that matches “(.a or .b) and .c”?

I know I could do this:

.a.c,.b.c {
  /* CSS stuff */
}

But, assuming I’m going to have to do this sort of logic a lot, with a variety of logical combinations, is there a better syntax?

5 Answers
5

Leave a Comment