-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of CSS :where as a class selector can be too specific #39971
Comments
We don't have a label for "What is the reasoning behind the change" - I feel the Help Request comes the closest for now. |
According to MDN docs, |
According to a specificity calculator that understands Level 4 selectors I know there has been some discussion about whether |
The specificity calculators return different results. The one you've linked seems to be more up-to-date than https://specificity.keegan.st/, so I'll use that as a reference. After further research and testing, the problem may not be due to the use of The problem is when I try to override the inline rules like The additional fact that the inline styles already use |
Closing this in favour of #40159. (The issue is with inlining the CSS, not with |
What problem does this address?
Using
main :where(h1,h2,h3)
(specificity 0,0,0) is less specific thanmain h1, main h2, main h3
(specificity 0,0,2) because using:where
in this scope has specificity zero.However, using
.wp-block-columns:where(.has-background)
(specificity 0,3,0) is more specific than.wp-block-columns.has-background
(specificity 0,2,0) and offers no practical benefits.This specificity makes it slightly harder to overrule in theme and plugin CSS.
What is your proposed solution?
Don't use
:where
as an alternative to a straight class selector. Previously, CSS on the columns block was.wp-block-columns.has-background
and the change to.wp-block-columns:where(.has-background)
has a negative effect and offers no benefits.The text was updated successfully, but these errors were encountered: