can clamp() be used for anything other than font-size
well I know what clamp() function is or what it does
I've only seen people using it for font-size but i wanna know if it is possible to use it anything else
for example, margin, padding or gaps
I also know about min() max() functions that we can use but i once used clamp() for gaps and it worked quite amazing
but since i never saw anyone using it , I'm sort of confused if it's bad or unorthodox to use it for anything other than font-size
tnx ❤️
4 Replies
In this project I'm currently working on I used it for font-sizes, widths and for some paddings of a couple buttons. I aswell recently found it out and decided to try it right away and I'm pretty satisfied of the result, not sure if it could be bad practice or could lead to other issues though
Using clamp for padding and widths should be fine as long as you are using the appropriate units.
I tend to use clamp for vertical padding in some cases where I feel the padding could come down gradually with the screen size for example
clamp(16px, 3vmin, 50px)
Thank you
gotcha.. tnx ❤️
i generally just use the online clamp calculators