Clamp the font sizes #2638
jenstornell
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
|
I just tried to JSmodule.exports = {
theme: {
extend: {
fontSize: {
dynamic: "clamp(1rem, 10vw, 2rem)",
},
}
}
};HTML<div class="text-dynamic">
I'm resizing depending on the screen width.
</div> |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
This look like a great feature, why no one consider it :\ Finding something like this |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
There is a quite new CSS feature called clamp. With clamp we can for example adjust the font sizes to mobile sizes.
For example I used
text-5xlon a site. While it looks great on a desktop, there are no reason to have it that big on a mobile device. A short text then takes up half the screen of a mobile device.How I solve it today
Future solution?
Auto adjust it so that the
text-5xlis a range betweentext-2xlandtext-5xldepending on the viewport size.https://css-tricks.com/linearly-scale-font-size-with-css-clamp-based-on-the-viewport/
Beta Was this translation helpful? Give feedback.
All reactions