:where(#main) p { color: red; }
p:is(.note, #x) { color: blue; }
article p.note { color: green; }
blue
Blue is right. :is() takes the specificity of its most specific argument, even one that doesn't match. So p:is(.note, #x) counts the #x id and is (1,0,1). Specificity is written as (ids, classes, types). That beats article p.note at (0,1,2), so green is the tempting wrong answer.
Red is wrong because :where() always adds zero specificity. So the first rule is just (0,0,1), for the p.
Read more
- :is() (MDN) (https://developer.mozilla.org/en-US/docs/Web/CSS/:is)developer.mozilla.org
- :where() (MDN) (https://developer.mozilla.org/en-US/docs/Web/CSS/:where)developer.mozilla.org