Question regarding responsive font sizes
Hello! I'm a new~ish web developer building a responsive website.
After researching on responsiveness, I've noticed that most people either go for clamp() or set different font sizes for specific break points.
What i would like to understand is if there are any benefits/disadvantages between them,
and which is one of them is more recommended.
Thanks in advance ^
3 Replies
Either one is fine, and you can even do both if you want.
I often use
clamp()
for my larger font sizes, and just have set ones that I change in media queries for the regular text.
I wouldn't say one is better than the other, or that one is a a better practice than the other.
It also depends on the design your working with as well, a lot of the time that can inform your decisions.In my opinion
clamp()
is better because you can set-it-and-forget-it. You set the min, max, and "grow factor" and regardless of the screen size the font will change (up to a point) and you don't have to worry about setting a new font size in each of your media queries.
I'm a big fan of:
h1–h6 based on Jen Simmons' CSS Remedy: https://github.com/jensimmons/cssremedy/blob/master/css/remedy.css.
Of course modify the middle (and potentially last) value of the clamp()
function as-needed to work for your chosen font.Thank you for your answers! I'll try to use out both methods and see which one i prefer with. Thanks again ^