If I read the specification correctly, no.
You can match on an element, the name of an attribute in the element, and the value of a named attribute in an element. I don't see anything for matching content within an element, though.
Answer from Dean J on Stack OverflowIs there a CSS selector for elements containing certain text? - Stack Overflow
How to Create CSS Selector Element including index
html - CSS Selector "(A or B) and C"? - Stack Overflow
CSS Selectors, visually explained.
Videos
If I read the specification correctly, no.
You can match on an element, the name of an attribute in the element, and the value of a named attribute in an element. I don't see anything for matching content within an element, though.
Looks like they were thinking about it for the CSS3 spec but it didn't make the cut.
:contains() CSS3 selector http://www.w3.org/TR/css3-selectors/#content-selectors
is there a better syntax?
No. CSS' or operator (,) does not permit groupings. It's essentially the lowest-precedence logical operator in selectors, so you must use .a.c,.b.c.
For those reading this >= 2021:
I found success using the :is() selector:
*:is(.a, .b).c{...}