Sibling selector (~) stopped working in Tailwind CSS v4 #18862
-
In Tailwind CSS v3, I used the following selector to style a [&_.rating-button:has(~.rating-button:hover)]:bg-red-500 Here Playground link: https://play.tailwindcss.com/ed3PRPUUgQ Is there a new way to write sibling selectors in v4? Or did support for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It's not the sibling combinator that is the problem. Rather, it is that stacked variants in v4 is applied in the opposite order to v3. So instead of |
Beta Was this translation helpful? Give feedback.
It's not the sibling combinator that is the problem. Rather, it is that stacked variants in v4 is applied in the opposite order to v3. So instead of
hover:[&_.rating-button]:
, you'd want[&_.rating-button]:hover:
.See https://play.tailwindcss.com/gFUDUHyKmu