-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v4] "hidden" is not the last display utility anymore #15884
Comments
You shouldn't ever have two utilities that apply the same CSS property in the same context, because -as you have found - order is not guaranteed. Consider toggling between them. |
With any other CSS property I would agree with you, but with As I am already using v4 for my project, I have "solved" this problem with a zero-width-breakpoint-version of |
You could use the |
Interesting, thanks for the tip, that might be a good alternative. |
@iquito Were you able to make it work with the |
@philipp-spiess Yes, the It was quite a bit of work though even in my not-so-huge application, so changing the order of the |
My Now, first, this is a breaking change, and I honestly don't know where it might pop up where I haven't noticed it yet. Second, how do I do this now? Or even, how was I supposed to do it before? The I guess from now on it's |
@finkrer the problem only exists if you set the E.g.: https://play.tailwindcss.com/dvYE6VFc7T This kind of issue already existed in v3, especially because unfortunately class order in the HTML doesn't matter. <div class="text-red-500 text-blue-500">…</div>
<div class="text-blue-500 text-red-500">…</div> E.g.: https://play.tailwindcss.com/d2zsKyorBH If you use the VSCode Intellisense plugin then you should see some squiggles (as you can see in the Tailwind Play link). If you use the prettier plugin, then we sort the classes to be consistent and to reduce the amount of potential issues you run into. |
What version of Tailwind CSS are you using?
v4.0
Reproduction URL
https://play.tailwindcss.com/1XH8TJa6s3 for v4 (element is shown)
https://play.tailwindcss.com/Ajm578zcYz for v3.4.15 (element is not shown)
Describe your issue
The order of the
display
utilities has slightly changed in v4, puttinghidden
somewhere in the middle of these utilities by default (afterblock
, but beforeinline-block
orinline-flex
), where in v3.4 it was at the end of all thedisplay
utilities. I have used TailwindCSS often like this:Then I remove or re-add the hidden class with Javascript, which worked fine in v3. In v4 this does not work with
inline-block
anymore (becauseinline-block
comes afterhidden
in the generated CSS), while it does work withblock
(as it comes beforehidden
). I found the behavior better in v3.4, wherehidden
was assumed to be the preferred/overriding value (if set) of all the display utilities and comes last in the definitions. I could imagine many people usedhidden
in this way and will find the new order surprising.The text was updated successfully, but these errors were encountered: