Browsers let readers choose a default text size. Most people never change it, so it stays at 16px. People with low vision often set it larger. In Chrome it’s under Settings, Appearance, Font size.
remis a multiple of that setting.1remis 16px for most readers, and 20px for someone who has chosen Large.pxis fixed. Text sized in px ignores the setting.emis a multiple of the text the element sits in. Padding of1emon a button is as wide as the button’s text is tall.
Try it
Change the browser text size. Both cards look the same at Medium. At Large and Very large, the rem card grows with the setting and the px card stays as it is, so its text is no easier to read.
Lot 8
Camille Pissarro (1830–1903)
Jalais Hill, Pontoise, 1867
Estimate: £3,500,000–5,500,000
font-size: 16px;
padding: 16px;
/* title */ font-size: 24px;Lot 8
Camille Pissarro (1830–1903)
Jalais Hill, Pontoise, 1867
Estimate: £3,500,000–5,500,000
font-size: 1rem;
padding: 1rem;
/* title */ font-size: 1.5rem;The Follow button’s padding is in em, so it keeps its shape as its text grows.
What it means for your designs
Keep designing in px. A design at the default setting is right for most readers, and a developer turns your sizes into rem by dividing by 16: a 24px title becomes 1.5rem.
What changes is what you allow for. Some readers see your text up to half as big again, so:
- Let boxes grow with their text. A card with a fixed height clips its title when the text gets bigger.
- Expect more lines. A two-line title at 16px might take three at 24px.
- Give spacing next to text in em or rem, so a button keeps its proportions. A 1px border can stay in px.
In Figma
Design at the default 16px base, as you do now. To check a key component, such as a lot card or a navigation bar, duplicate it and scale the text by 1.5 (24px body text). Whatever breaks there will break for some readers.
When spacing should follow the text, add a note: “Button padding: 0.5em 1em, so it grows with the label.”
Say this to a developer
“Can text sizes be in rem, and padding on buttons and tags in em? And we shouldn’t set a px font size on the page itself, so the reader’s setting still works.”
/* Leave the root font size alone: the reader's setting lives there. */body { font-size: 1rem;}
h2 { font-size: 1.5rem; /* 24px at the default setting */}
.button { font-size: 0.875rem; padding: 0.5em 1em; /* in em of the button's own text */}Watch out for
Gotcha
Zoom and the text size setting are different things. Zoom makes everything bigger, px included, so px text passes a zoom test. Only rem and em follow the text setting. Test with the setting as well.
- Don’t size everything in rem. Borders, hairlines and shadows stay in px, because they shouldn’t get thicker for readers who want bigger text.
- An
emmultiplies when nested. A list inside a list, each at0.9em, gets smaller at every level. Use rem for text sizes and keep em for spacing. - Unitless line heights, such as
1.5, scale with the text. A line height in px doesn’t, so bigger text overlaps.
Browser support
Every current browser, and every browser for more than ten years.