Reputation: 3071
Reading https://tailwindcss.com/docs/responsive-design#overview docs I do not see any classes for extra small devices(like iPhone 5)
So if I need to made different design for iPhone 5 and nexus 7 is there is a way to make it with tailwindcss ?
Thanks!
Upvotes: 7
Views: 18764
Reputation: 1
Yes there is way make things responsive for xs devices. How I achieve this is with a mobile first appraoch. SO instead of styling everything for md or lg devices, I would set for eg. p-20 md:p-10, this way I get the exact design I want on xs devices and tweak as necessary on bigger devices.
Hope this was helpful.
Upvotes: 0
Reputation: 8927
What this means is that unprefixed utilities (like uppercase
) take effect on all screen sizes, while prefixed utilities (like md:uppercase
) only take effect at the specified breakpoint and above.
e.g. text-xs sm:text-base md:text-lg
. In such case font-size will follow:
font-size: 0.875rem;
font-size: 1rem;
font-size: 1.125rem;
So your iPhone 5 being 320px will follow text-xs. And your Nexus 7 width 600px will still follow text-xs.
If you still want to add additional screens then you can do:
// tailwind.config.js
module.exports = {
theme: {
screens: {
'xxs': '540px', // min-width
},
}
}
e.g.
text-xs xxs:text-sm
screens will follow text-xs till 539px then Nexus 7 will follow text-sm till 639px.
Upvotes: 20