That's what happens when we use PX for font sizes: we ignore user preferences and impose the exact size we've chosen.
🤔🧐
Actually all modern browsers handle adapting font size in px according to user preferences...
px css unit doesn't actually rely on screen pixels but reference pixels, equivalent to 1/96 inches, meaning dependent to the density of screen in dpi but also the zoom level of the browser.
I don't really see a good reason using rem instead of px excepts increasing difficulty of code.
Someone once said: "If you learned it, you can do it. But through teaching, you can master it". Or maybe I'm making this up, but the point is the same. Welcome =)
Someone once said: "If you learned it, you can do it. But through teaching, you can master it". Or maybe I'm making this up, but the point is the same. Welcome =)
Actually all modern browsers handle adapting font size in px according to user preferences...
I don't think that's true. I just tested Chrome and Firefox and neither adapt rendered font size defined in px to font default settings. Appearance -> Font size: very large (Chrome) or General -> Fonts -> Font size (Firefox) don't affect font sizes when they are defined in Pixels. Percentages or rem on the other hand do respect the default font size.
Someone once said: "If you learned it, you can do it. But through teaching, you can master it". Or maybe I'm making this up, but the point is the same. Welcome =)
🤔🧐
Actually all modern browsers handle adapting font size in px according to user preferences...
px css unit doesn't actually rely on screen pixels but reference pixels, equivalent to 1/96 inches, meaning dependent to the density of screen in dpi but also the zoom level of the browser.
I don't really see a good reason using rem instead of px excepts increasing difficulty of code.
Sorry, but that is not the case.
They do scale font with zoom, but if you set your font to pixels they are not going to adapt it to the user's font preferences.
So, you should not set your font size in pixels.
And I know it takes a while to adapt to writing in REM, but you eventually get used to it =)
And yeah, pixel actual size varies from device to device, due to screen density.
What difference do you make between browser zoom and user preference ? Can you provide an example ? Thanks
Changing the default size is like this: chromestory.com/2022/09/change-tex...
On the other hand, when you zoom in, browser adapts content, unless it is related to viewport size.
Again, using REM is not outdated in any way.
Thanks for the precision, didn't knew this feature.
I don't think that's true. I just tested Chrome and Firefox and neither adapt rendered font size defined in
pxto font default settings.Appearance -> Font size: very large(Chrome) orGeneral -> Fonts -> Font size(Firefox) don't affect font sizes when they are defined in Pixels. Percentages orremon the other hand do respect the default font size.Indeed my mistake. As mentionned in my reply to @marcelluscaio I was refering to zoom level, I didn't knew this font size setting.
Great demo, Stefan! Interesting to notice that in font-sizes the percentage unit refers to the default font-size, so 100% is equivalent to 1rem