Global styles: Lower selector specificity for declaring CSS properties (CSS variables) #40042
Labels
CSS Styling
Related to editor and front end styles, CSS-specific issues.
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
Description
Currently WordPress global styles declare CSS properties/variables on
body
selector:This seems to be quite high specificity as themes and plugins can not use
:root
orhtml
now to override those CSS variables.It would be great if WordPress CSS variables in global styles are declared on
:where(:root)
selector, which provides low enough specificity:That way also
:root
selector used in themes and plugins can override WordPress global styles CSS variables with ease.There is really no need to set such high specificity (meaning using
body
selector) for declaring default CSS variables in my opinion.Step-by-step reproduction instructions
Not applicable here.
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 5.9+
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
The text was updated successfully, but these errors were encountered: