Replies: 9 comments 24 replies
-
I like this idea. It could speed up development. At least until container queries arrive in CSS/Tailwind. The downside would be that we could end up with very many breakpoints, a "breakpoint hell". But that's the downside to arbitrary values in general. |
Beta Was this translation helpful? Give feedback.
-
To add another use-case: we have two images, one with a portrait layout and the other with a horizontal one. Depending on the layout, we want to switch between the two. This works, but on our narrowest layout (single column) there are still plenty of devices that could fit the wider image, which would reduce the overall page height (and, frankly, look better). There's no point adding a custom breakpoint for this single component, but it would be nice to have that slight flexibility in the editorial control. |
Beta Was this translation helpful? Give feedback.
-
You can do this now using arbitrary variants 👍 https://play.tailwindcss.com/XaNfzyHXsr <div class="h-64 bg-red-500 [@media(min-width:711px)]:bg-green-500"></div> Syntax is a bit verbose so maybe something we could simplify more in the future but it's at least possible when you need that escape hatch 👍 |
Beta Was this translation helpful? Give feedback.
-
i get same problem , any solution ? |
Beta Was this translation helpful? Give feedback.
-
Now you can use the new range syntax: <div class="h-64 bg-red-500 [@media(width>=400px)]:bg-green-500"></div> |
Beta Was this translation helpful? Give feedback.
-
came here because the docs mention to use:
Is this still valid? Doesnt work for me with latest TWCSS. And then, which one should i use? |
Beta Was this translation helpful? Give feedback.
-
I have confirmed that none of these work for me. |
Beta Was this translation helpful? Give feedback.
-
class: `border-2 max-[${TW_SCREENS.XS}px]:border-red-500 max-[${TW_SCREENS.MD}px]:border-green-500 max-[${TW_SCREENS.XL}px]:border-orange-500`, produces this warning:
and styles aren't applied. |
Beta Was this translation helpful? Give feedback.
-
How would you apply this to something like |
Beta Was this translation helpful? Give feedback.
-
Currently we can use arbitrary values for those rare situations we need to break out of our design system
I think it'd also be helpful to occasionally use custom breakpoints as well.
I have one very specific use case for this. When our main menu is below about 400px, we just have too much stuff in it and we have wrapping issues, but I don't want those things to get the adjusted style between 400px and SM.
I am a little hesitant to propose this idea, because if abused you could definitely lose out on some benefits of Tailwind, but I figured I'd throw it out to the group.
Beta Was this translation helpful? Give feedback.
All reactions