Home > Back-end >  In Tailwindcss, how do I set a margin for the smallest screen only, and leave the rest screen sizes
In Tailwindcss, how do I set a margin for the smallest screen only, and leave the rest screen sizes

Time:12-19

In my specific case i want

<div className="mx-auto"...</div>

but only if the screen is the smallest. Doing:

<div className="sm:mx-auto"...</div>

will have the opposite affect (of setting margin to auto for small screens and up).

CodePudding user response:

As of Tailwind 3.2 you can use max-sm:mx-auto to achieve what you want. More info can be found here.

  • Related