@screen directive in v4 #15960
Replies: 3 comments 12 replies
-
As an aside, Adam Wathan (creator of Tailwind) does seem to advocate avoiding |
Beta Was this translation helpful? Give feedback.
-
Hey there! It looks like the @layer components {
.my-class {
@apply grid-cols-3;
}
} Then, for the responsive part, you just use Tailwind’s built-in responsive classes directly in your HTML, like: <div class="sm:grid-cols-3 lg:grid-cols-6">
<!-- Your content here -->
</div> For more details, make sure to check the updated docs for v4, especially regarding how to handle responsive utilities. The update should make things more intuitive once you get the hang of it! Let me know if that clears things up! |
Beta Was this translation helpful? Give feedback.
-
Try something like this: @media (min-width: theme(--breakpoint-md)) {
body {
@apply bg-gray-100;
}
} |
Beta Was this translation helpful? Give feedback.
-
Hi,
Im running into issues with tailwind on postcss where the screen directive no longer works.
I upgraded to v4 with the postcss options (@tailwindcss/postcss)
Now, i checked the docs on v3 and screen() is on there.
https://v3.tailwindcss.com/docs/functions-and-directives#screen
But there are no mentions of it on v4
https://tailwindcss.com/docs/functions-and-directives
On v4 however, its not and its also not in the upgrade guide that its been removed and what else we can use instead of screen() or
@screen
So my question is, what can i use now or what should i change?
Example;
No longer works
Beta Was this translation helpful? Give feedback.
All reactions