Home > General Development > Why font-size must never be in pixels Why font-size must never be in pixels Thom Holwerda 2023-08-14 General Development 4 Comments Certain font-related CSS properties will render your site completely inaccessible if their value is declared using pixels even once. Just read it and absorb the information. About The Author Thom Holwerda Follow me on Mastodon @firstname.lastname@example.org 4 Comments 2023-08-14 5:33 pm Nico57 Oh yeah. It’s 2023, Windows has had support for variable DPI for some 25 years, but still always end up using the “100%” setting (name says it all), only use monitors with “large pixels”, and just get closer to my notebook’s screen while my eyes can bear it, because otherwise so many apps break. Websites are only part of the issue. 2023-08-14 6:03 pm tiller I really don’t think this is true. The sentence: “If you’ve used pixels to define any of the above style properties, these will not respect the user’s font size preferences!” Is wrong. Both Firefox and Chrome allows the user to scale the font size for any website, no matter how the size if specified. (I normally browse with my font set to 120%, and have newer encountered any problems with this at all). It would be nice if the linked website, had a link to a single live website, which showed the problems mentioned, and where changing sizes from px to rem would solve anything. Because I have newer seen such a website 2023-08-15 3:03 am bubi On my HTPC I have screen scaling set to 125% and browser font size to 120% as it’s the sweet spot seeing anything clearly lying on the couch. 2023-08-16 11:37 pm sukru Let us be honest here. Back in the day… way back… Windows 3.1 defaulted to bitmap (raster) fonts with fixed defined sizes, since the old i386 CPU could not render True Type (vector) fonts at the time. (If there were bitmaps for only 12pt and 14pt, you could not have a 13pt font. And yes it was 1pt = 1px). For “newer” CPUs, though, could finally bring those “advanced” features: https://www.washingtonpost.com/archive/business/1992/06/22/truetype-technology-gives-windows-31-a-fountain-of-fonts/f084af45-d523-4ea1-a4c6-6c2002af83eb/ Today we have modern typography, including techniques like ligatures for coding and so on: https://github.com/tonsky/FiraCode Why am I mentioning this? Over the years our machines have become much more capable. Of course Windows (or Linux) did not have Hi-DPI or scalable UI support. It was practically impossible (except maybe the wizards at Enlightenment, though it never reached 1.0). https://www.enlightenment.org/start This was a process, and we could not skip any of the steps. Bringing scalable UIs with multiple display support and desktop composition to early XWindows/Windows/Mac would be a nonstarter. Though… Now we are stuck with support for legacy apps and a mix of fixed and variable UI definitions. For most apps the default OS settings suffice well. Every now and then, and older Java Swing app will load with completely broken interface. (An unfortunate side effect of being platform independent is also losing the advancements on that platform).