top | item 35567779

(no title)

eajakobsen | 2 years ago

If you want it to be even more readable you could do the following:

    font-size: clamp(1em, 1.3vw, 1.3em);
I would also consider using `rem` instead of `em` incase you want to use it anywhere other than the root element.

discuss

order

itsuka|2 years ago

I don't see any issues with this particular code (although for larger sizes, there may be an accessibility issue related to zooming). In general, I would recommend avoiding the use of vw-only units because the computed value may not change with zoom.

I learned this from https://adrianroselli.com/2019/12/responsive-type-and-zoom.h...

nhanb|2 years ago

I would only use this kind of thing on the root element, then size all other elements relative to the root element e.g. h1 { font-size: 1.5rem; }. It's more manageable that way IMHO.

Thanks for the tip on clamp() by the way, TIL.

hgsgm|2 years ago

That's less reasable bwcause the order of arguments is mysterious.