Website notes

09/01/22

px vs rem in font-size

  • whatever font size is set on html is what rem is relative to
  • percentages in font-size are equivalent to using em/100
  • except on html, because there’s no parent, so it refers to the browser font scaling, which is 16px by default on major browsers, but can be scaled to be 9 <= x <= 72 in settings
  • browser zooming additively scales everything, on top of browser font scaling
  • almost all websites do not respect browser scaling, because they set a hard-coded font-size on html, or use px which opts out of scaling entirely
  • when browser scaling is ignored, there’s no a11y reason to use rem over px
  • jwc article