Skip to content
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

[Style] - Inline style !important and CSS variable scope #62959

Open
webexpr-dhenriet opened this issue Jun 28, 2024 · 4 comments
Open

[Style] - Inline style !important and CSS variable scope #62959

webexpr-dhenriet opened this issue Jun 28, 2024 · 4 comments
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Type] Enhancement A suggestion for improvement.

Comments

@webexpr-dhenriet
Copy link

webexpr-dhenriet commented Jun 28, 2024

Is there any reason to put a !important on all inline styles generated by theme.json ?

.has-black-800-color {
    color: var(--wp--preset--color--black-800) !important;
}

this should be enough ? Would it be possible to remove !important ?

.has-black-800-color {
    color: var(--wp--preset--color--black-800);
}

For CSS variables, why is the scope body and not :root ?

body {
    --wp--preset--color--black: #000000;
}

Would it be possible to encapsulate them in :root ?

:root {
    --wp--preset--color--black: #000000;
}
@webexpr-dhenriet webexpr-dhenriet added the [Type] Enhancement A suggestion for improvement. label Jun 28, 2024
@Mamaduka
Copy link
Member

I've seen a similar discussion somewhere but can't find it now.

@ndiego, do you remember anything related/similar?

@jordesign jordesign added the CSS Styling Related to editor and front end styles, CSS-specific issues. label Jul 1, 2024
@skorasaurus
Copy link
Member

@Mamaduka -

It's been a source of frustration for myself and several others but the reasons are outlined in #37590 (comment)

@Gierand
Copy link

Gierand commented Jul 5, 2024

For CSS variables, why is the scope body and not :root ?

body {
    --wp--preset--color--black: #000000;
}

Would it be possible to encapsulate them in :root ?

:root {
    --wp--preset--color--black: #000000;
}

This has now been fixed (with Gutenberg plugin or WP 6.6).

@webexpr-dhenriet
Copy link
Author

@Gierand thanks for your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

5 participants