(no title)
nhanb | 2 years ago
That's what the outer min() is for: it makes sure the font size caps out at 1.3em which usually translates to 16 x 1.3 = 20.8px, which is well within the recommended size range for prose anyway.
What that whole snippet does boils down to exactly what they said in the article:
> The main global stylesheet uses the browser default font size, smoothly scaled up to 130% on higher-resolution displays as the baseline for the body text of the whole document.
On a low-dpi screen, nothing changes. On a high-dpi one, if you haven't set your browser text size to something larger, this snippet saves you from tiny unreadable text. Also note that ctrl+ and ctrl- to zoom still work just fine. It's not as dramatic a change as the sibling comment said. You can try it out on their site to see for yourself.
account42|2 years ago
Recommended by people who only read twitter-length content maybe.
> On a low-dpi screen, nothing changes.
Repeat after me: viewport width has nothing to do with DPI.
This absolutely does change the font size on large low DPI screens.
If you want to scale with DPI you don't have to do anything. CSS already does that for you by default. Even "px" is scaled by DPI in CSS.
> On a high-dpi one, if you haven't set your browser text size to something larger, this snippet saves you from tiny unreadable text.
Yes, don't do that. Respect the users settings as they are set or give up any pretense that you are doing so and just set reasonable fixed font size.
> Also note that ctrl+ and ctrl- to zoom still work just fine. It's not as dramatic a change as the sibling comment said. You can try it out on their site to see for yourself.
That you can fuck things up even worse does not make this "hack" good.