Responsive font sizes with clamp #4796
jenstornell
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Tailwind font sizes are great in general. However, when using them on a mobile device they often need to be smaller than on a desktop screen.
You can do something like below and check every breakpoint, but it can be a mess to do it with all texts on the site.
To solve this I recreated the font sizes exactly the same as Tailwind has originally with one big difference, they will adapt to the screen size.
I used this tool to generate them. https://codesandbox.io/s/clamp-linear-intepolation-based-on-viewport-width-builder-xgkft?from-embed
Beta Was this translation helpful? Give feedback.
All reactions