.not { color: red; } div:has(.not) { color: black; } bar span:not(.not) { color: black; } span:not(bar.foo) { color: black; } span:not(bar.not) { color: black; }