I want to apply a style only for elements that have NOT both classes class1
AND class2
In this example I want "has both" to be red (this works), and "has one" and "has another" to be grey (this doesn't work).
The following example does not make the job. Is there a way to do that and to save my day ?
div.class1.class2 { background: red; }
div:not(.class1.class2) { background: grey; }
<div class="class1">has one</div>
<div class="class2">has another</div>
<div class="class1 class2">has both</div>
<div class="class3">has anything else</div>
When I study the syntax https://developer.mozilla.org/en-US/docs/Web/CSS/:not, it seems that it is not possible. But in case of I misread it, or some undocumented ways to do this exists, I ask you for it.