argyleink / open-props

CSS custom properties to help accelerate adaptive and consistent design.
https://open-props.style
MIT License
4.7k stars 191 forks source link

Use 62.5% body size in normalize (?) #502

Closed toastal closed 3 months ago

toastal commented 3 months ago

https://snook.ca/archives/html_and_css/font-size-with-rem https://www.freecodecamp.org/news/override-root-font-size-for-a-better-user-experience/ https://medium.com/@jagadishkamuni/respecting-font-size-preferences-rems-and-62-5-base-font-size-aleksandr-hovhannisyan-f0473d6c8410

There is a long history of doing html { font-size: 62.5% } body { font-size: 1.6rem } in projects as most (but not all!) user agents have 16px as the default base font. Resizing the base from 16 to 10 makes it a lot easier to work with rem units outside of --size-* as it is just a base10 decimal point shift away from the given design size. It’s been a good practice to use rems for many sizings as this project does since the default user agent is respected, however, in practice, I very often find myself with designs to implement whose sizes are always using pixels (from Figma or other software). Doing the conversions from 24px to 1.5rem is a much slower exercise than converting 24px to 2.4rem. It’s been slow enough that on more than one project I have used Open Props already, I swapped out the entire sizes file & converted everything to lighten the burden of reading/translating designs in practice.

Seeing that there is a 2.x on the horizon, I am curious if this has been considered. I appreciate that most values in the project are rem-based for respecting user agents, but I would personally love to see 62.5% as I did not see any existing discussions anywhere about the topic as a gauge of interest.

argyleink commented 3 months ago

There is indeed a long history of it but I don't foresee a version of normalize shipping with the strategy. That ability to not use the sizes and roll your own is exactly the path to take if you're calculating rems to pixel equivalents.

Thanks for pinging and asking! Going to close for now.