Replies: 1 comment 3 replies
-
Hey! Sorry if I'm not understanding, but can you not just write this? h1 {
--color: red;
} Why does Here's a working example: |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is a strategy popularized by Pico CSS where your styles target HTML element types instead of having to apply them to every instance of an element or make wrapper components.
For example, Pico does something like:
This idea of semantic theming is also used in shadcn/ui; however it doesn't take it as far as Pico, as you still need to apply your classes everywhere.
Tailwind v4 allows specifying theme variables like:
However, if you want to dynamically style semantic elements by modifying the CSS variable according to a selector like in Pico in combination with Tailwind, we run into problems.
Trying to put the selectors inside
@theme
errors:with
My only other idea for this is changing the order of wrapping:
This doesn't give an error, but the color that was last defined always applies everywhere. Here, an h1 would be blue as well.
Please provide a solution for this case.
Beta Was this translation helpful? Give feedback.
All reactions