Line Height and Text Spacing
A unitless line-height is inherited as a factor that scales with each element's font size, while letter-spacing, word-spacing and text-transform fine-tune how a line reads.
Compare line-height and spacing choices across nested text with different font sizes.
The café's menu uses a beautiful font at the right size, yet descriptions still feel cramped and hard to read. The usual culprit is not the font at all. It is the space between the lines and between the letters.
The rule
Give lines room with a unitless line-height; nudge letters in em.
line-height sets the height of each line of text. Long reading text is comfortable at about 1.4 to 1.6 times the font size; big headings look better tighter, around 1.1 to 1.25.
Use a unitless number, and the reason is inheritance:
line-height: 1.5passes the factor down. Each element multiplies it by its own font size.line-height: 1.5emor24pxis converted to a length once, on the element where you set it, and that fixed length is what children inherit.
body {
font-size: 1rem;
line-height: 1.5; /* every element gets 1.5 × its own size */
}
h1 {
font-size: 2.5rem;
line-height: 1.15;
}The spacing properties fine-tune the gaps inside a line:
letter-spacingadds space between characters. Small caps and all-caps labels read better with a little extra, such as0.05em. Usingemmeans the gap scales with the text.word-spacingadds space between words. Rarely needed, but handy for spaced-out labels.text-transformchanges the displayed case, such asuppercase, without changing the text in the HTML.
.site-nav a {
text-transform: uppercase;
letter-spacing: 0.08em;
}The HTML still says "Menu" and "Visit"; only the display shows "MENU" and "VISIT", so the words stay easy to edit and translate.