← Back to context

Comment by hollowturtle

3 days ago

> 1rem is equal to the same number of pixels anywhere on a given page and, generally speaking, across pages on a given site.

That's not true, first of all the root font size might not be immediate to query and find out what it is, second it might change because of variables on the root or base font size might be percentage/rem based itself not necessarily in pixels and finally setting it in pixels doesn't take into consideration zoom levels, or OS-level font settings.

> REMs have been around and standard practice for 10 years.

I know but thanks for flexing it out, in fact I'm arguing that css is and has been bad for many years

My point was that there is only one root font size on a given page and it's trivial to find out what that is by looking in dev tools. It does not matter if it was set by the browser's user-agent stylesheet or an authored stylesheet or what units it was set in. You can simply look up its computed value.

What use case is that not sufficient for? What kind of nightmare page are you styling where code you don't control is dynamically changing the root font size? Why do you need its exact computed value at all? The whole point of REMs is to style based on relative proportions to the text size e.g. when text is size X, buttons should have x padding on top/bottom and 2x on the sides. If the user sets their preferred font size to another value I do not care.

  • I use rems I don't love them but it's less worse unit we have. My point was more on grid being convoluted and media queries with arbitrary values like media (max-width: 32rem)