[v4] How to apply css precedence in the class string? #15345
Unanswered
sureshjoshi
asked this question in
Help
Replies: 1 comment 1 reply
-
Although a bit unweildy, you could consider applying |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm working on a Svelte 5+ HeadlessUI port, and ran into an issue with css precedence (rather, I just don't know how to apply it 😢)
https://github.com/RobotPajamas/headlessui-svelte/blob/button-actions/src/routes/examples/button/%2Bpage.svelte
I've tried sandwiching the hover attribute with active (
data-active:bg-pink-500 data-hover:bg-gray-600 data-active:bg-pink-500
), but I'm unable to get active to override. In addition I've prefixed with a !, but that doesn't seem to help (arguably hinders).I thought to use the
!important
config, but it looks like that won't be supported: https://tailwindcss.com/docs/v4-beta#using-legacy-configuration-filesHere is a live example (best avoided by Safari): https://button-actions.headlessui-svelte.pages.dev/button
hover:
left-click (active is lower priority than hover):
right-click (active, but no hover):
Beta Was this translation helpful? Give feedback.
All reactions