Ancestor class based styling #15370
Unanswered
benjaminpreiss
asked this question in
Help
Replies: 1 comment 5 replies
-
Seems to work in this Tailwind Play which would indicate something particular to your project that is causing the unexpected behavior. Consider checking:
Otherwise, consider providing a project that reproduces the unexpected behavior. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to style an element based on the presence of a class in one of an elements ancestor. The class is called
video-start
and is added to the parent when I click on a button.Then, on a descendant element of that child, I want to add the style
-translate-x-full
when the ancestor has the classvideo-start
present. I am using[.video-start_&]:-translate-x-full
for that. But somehow, no styles are added.See the screenshots for reference. Anybody know why? Is this a safe listing problem? I don't have safe listing problems with the other classes
Parent element inspection:
Child element inspection:
Svelte component:
Beta Was this translation helpful? Give feedback.
All reactions