-
I was wondering if orientation based container queries were possible in v4? In general, I want to style a child based on the orientation of the parent (not necessarily the size of it.) I half expected this to work:
In this example, the child background should be blue when the container is in landscape and green when in portrait. I was inspired by this blog and it does work if I write it manually, just wondering how to achieve the same in V4 if possible: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You could consider using the @import "tailwindcss";
@custom-variant foo (@container (orientation: landscape));
@custom-variant bar (@container (orientation: portrait)); <div class="foo:bg-blue-500 bar:bg-green-500">Child</div> |
Beta Was this translation helpful? Give feedback.
The parent needs
container-type: size
it seems: https://play.tailwindcss.com/H7uG0d04ZR