Miriam Suzanne avatar Miriam Suzanne

Reimagining Fluid Typography

Screenshot of “Reimagining Fluid Typography”

Never do pixel math with em and rem units. That’s where we went wrong, by assuming that 16px == 1em is a reliable fact.

It reminds me a lot of what I was pretty vocal about a few years ago, including “People don't change the default 16px font size in their browser (You wish!)” and “Users DO change font size”.

But I don't understand how this code suggested by Miriam would fix the issue with “some of my favorite sites already using large type become too large when I set my browser preference. So I had to remove that preference.”:

html {
  font-size: clamp(1em, 0.9em + 1vw, 1.5em);
}