Font Sizing & Spacing

How font-size, line-height, letter-spacing, and word-spacing combine to make text readable, and why a unitless line-height is the one form you should reach for.

CSS6 min readConcept 10 of 43

Four properties that decide how text fills its space

font-size sets the size of the glyphs. The unit you pick decides what it is relative to: px is fixed, rem is relative to the root element, and em or % are relative to the parent element's font-size (and compound when nested).

line-height sets the height of each line box. The unitless form like 1.5 is a multiplier: each line is 1.5 times the element's own font-size. The form 1.5em or 150% is computed once at the element where it is set and then inherited as a fixed pixel value.

letter-spacing adds (or removes, if negative) space between every character. word-spacing does the same but only between words. Both inherit and both take a length relative to the element's own font-size when you use em.

Readable text is mostly line-height and spacing

Long body copy at line-height: 1 is hard to read because the eye loses its place between lines. Bumping to 1.5 gives the eye a clear gap to track, which is why WCAG Success Criterion 1.4.12 asks for at least 1.5 on body text. The unitless form keeps that gap proportional no matter what font-size a child uses.

letter-spacing and word-spacing are how you tune a headline from default system spacing into something that looks set by a designer. Tightening a large headline by letter-spacing: -0.02em removes the optical gaps caps leave, and loosening small uppercase labels by 0.1em makes them legible.

Knowing that em and % compound through nesting is what stops a component from blowing up when it gets dropped inside a larger text context. rem for sizes and unitless multipliers for line-height are the predictable defaults for exactly this reason.

The values and forms that matter day to day

**font-size units:** px (fixed, 16px is the browser default), rem (relative to the root, scales with user font-size preference), em and % (relative to the parent, compounds when nested), and keywords like small / medium / large. For most component sizing, rem is the safe pick because it never compounds.

**line-height:** prefer the UNITLESS form. line-height: 1.5 is inherited as a multiplier, so a child with font-size: 2rem gets a 3rem line box automatically. line-height: 1.5em computes to a fixed pixel value at the parent and is inherited as that fixed number, which breaks proportional spacing in any child whose font-size differs.

**letter-spacing:** takes a length, usually in em so it scales with the font. letter-spacing: -0.02em tightens a headline, 0.1em loosens a small uppercase label. It applies to every character including the last one in a word, which is why a small negative value on tightly-set caps often looks better than none.

**word-spacing:** adds space between words, not characters. Useful for justified text or small uppercase labels. Inherited, and em is relative to the element's own font-size.

**The font shorthand:** font: italic 700 1.25rem/1.5 \"Inter\", sans-serif; sets style, weight, size, line-height, and family in one declaration. Size and family are required and must be in that order, with line-height after a slash right after the size. Forgetting any sub-property in the shorthand RESETS it to the initial value, so font: 1rem \"Inter\"; silently sets line-height: normal even if you set 1.5 elsewhere.

Try it

See line-height at 1, 1.5, and 2 on the same paragraph with a baseline grid revealing the rhythm, then compare letter-spacing tight, normal, and loose on a headline.

line-height rhythm

/* same text, three line-heights */
.a { line-height: 1 }
.b { line-height: 1.5 }
.c { line-height: 2 }
 
/* unitless: inherited as a multiplier */

line-height rhythm

line-height: 1cramped, hard to track
The eye needs a gap between lines
to track back to the next one.
Tight spacing makes long copy hard.
line-height: 1.5WCAG 1.4.12 baseline
The eye needs a gap between lines
to track back to the next one.
Tight spacing makes long copy hard.
line-height: 2airy, good for short blocks
The eye needs a gap between lines
to track back to the next one.
Tight spacing makes long copy hard.
The unitless form is inherited as a multiplier, so a child with a different font-size keeps proportional spacing.

letter-spacing comparison

/* tracking on the same uppercase text */
.tight { letter-spacing: -0.02em }
.normal { letter-spacing: normal }
.loose { letter-spacing: 0.1em }

letter-spacing on a headline

letter-spacing: -0.02emtightens a headline
Set by Design
letter-spacing: normalfont default
Set by Design
letter-spacing: 0.1emloosens small labels
Set by Design
`em` scales with the font-size, so the same value works proportionally at any size. `px` does not.

font shorthand reset

/* global rule */
body { line-height: 1.4 ; }
 
/* shorthand on a heading */
h1 { font: 1.25rem "Inter" ; }
 
/* line-height RESETS to normal: line-height was omitted */

font shorthand reset

without /line-height
Heading text

`line-height` resets to `normal` (about 1.2). The global 1.4 is overridden by the shorthand.

with /line-height in the shorthand
Heading text

`font: 1.25rem/1.4 "Inter"` keeps the 1.4. Every omitted sub-property in `font` resets to its initial value.

The `font` shorthand is a reset. Include `/line-height` inside it, or set the sub-property separately after the shorthand.

Check yourself

Pick an answer to lock it in, then read why. Getting one wrong is part of how it sticks.

  1. 1You set `line-height: 1.5em` on a card wrapper. A child inside it has `font-size: 2rem` (twice the wrapper's size). What line-height does the child get?
  2. 2You write `font: 1.25rem "Inter";` on a heading. Earlier in your stylesheet you set `line-height: 1.4` globally. What is the heading's line-height?
  3. 3Which `letter-spacing` value would most likely make a large uppercase headline look tighter and more optically balanced?

Remember this

  • Use the UNITLESS form for line-height (1.5, not 1.5em or 150%). It is inherited as a multiplier so spacing stays proportional at every font-size.
  • rem for font-size is predictable because it never compounds. em and % are relative to the parent and compound when nested.
  • The font shorthand resets every omitted sub-property to its initial value. Always include line-height after the slash or write the sub-properties separately.
  • letter-spacing tightens (negative) or loosens (positive) between characters; word-spacing only affects gaps between words. Both inherit.

Done with this concept?

Mark it complete to track your progress. No login needed.