Typography
Working with type and the rules of setting text
What is Typography?
Typography is the craft of working with type: choosing typefaces, sizes, weights, line height, line length and the arrangement of text on a page. It also covers the typographic conventions of each language, such as when to use a hyphen or a dash, where a non-breaking space belongs and what quotation marks look like. On the web, typography is defined in CSS and has to work on a phone as well as on a large monitor. Good typography goes unnoticed because the text is simply easy to read.
Why It Matters
Most website content is text, so typography decides whether people read it and find what they came for. Small type, low contrast or overly long lines hurt readability and web accessibility. Mistakes such as a hyphen instead of a dash or a broken number and unit look careless, much like a typo. Consistent fonts and a clear heading hierarchy strengthen brand recognition. The number of web fonts a site loads also affects page speed.
Real-World Examples
- 1Body text set at 16 px with a line height of around 1.5.
- 2An en dash in ranges (9–17) and a hyphen in compound words (well-known).
- 3A non-breaking space between a number and its unit, so 10 km never splits across lines.
- 4Curly quotation marks “like this” instead of straight ones.
- 5One typeface for headings and another for body text, both supporting all the languages of the site.
What typography means
The word comes from Greek: typos means impression or mark, graphein means to write. It began as the craft of typesetting and printing. Today it has two meanings:
- Typography as design: choosing typefaces, sizes, weights and layout so that text is readable and fits the brand.
- Typography as text conventions: language-specific rules for dashes, spaces, quotation marks, numbers and abbreviations.
Websites need both. A well-chosen typeface does not help if the text is full of typographic errors, and flawless text set too small will not be read.
Typography basics: key terms
- Typeface (font family): a complete set of characters in one design, such as Roboto or Georgia. The main split is serif and sans-serif.
- Font and weight: a specific variant of a typeface, such as bold or italic. In everyday use, font and typeface are used interchangeably.
- Font size: set in px or in relative rem units on the web. Browsers default to 16 px.
- Line height (leading): the distance between lines, the CSS line-height property.
- Tracking and kerning: spacing across all letters (letter-spacing) and adjustment between specific letter pairs.
- Line length: the number of characters per line. Long lines tire the eyes, very short ones break up the text.
- Hierarchy: distinguishing headings, intro, body text and captions through size, weight and spacing.
How these properties are written into a website's code is covered in the CSS entry.
Typography rules for the web
The rules below come from common practice and from the WCAG guidelines used to assess web accessibility:
- Body text of at least 16 px. Do not shrink it on mobile; increase line height instead.
- Line height of about 1.5 times the font size for body text; headings can be tighter.
- Lines of up to 80 characters. WCAG lists this as the maximum at level AAA; 50 to 75 characters is common practice.
- Left-aligned text. Justified text creates uneven word gaps on the web, because browsers cannot hyphenate as well as typesetting software.
- Text contrast of at least 4.5:1 against the background, 3:1 for large text. Light grey text on white is the most common mistake.
- No more than two typefaces. One for headings and one for body text, or a single family in several weights. Pick text colours from the brand's colour palette.
- A clear heading hierarchy. One H1, then H2 and H3 at the same sizes across the whole site.
- Text must survive user adjustments. Under WCAG 2.2 (success criterion 1.4.12, level AA), nothing may break when a reader sets line height to 1.5, paragraph spacing to 2 times, letter spacing to 0.12 and word spacing to 0.16 times the font size. Avoid fixed heights on text containers.
Language-specific rules: dashes, spaces and quotation marks
Typographic conventions differ between languages, so a multilingual website needs to follow each one. The points most often done wrong:
- Hyphen vs. dash: the hyphen (-) joins words (well-known). The en dash (–) marks ranges (9–17, London–Paris). As punctuation within a sentence, English uses either a spaced en dash or an unspaced em dash (—), while Czech and Slovak use a spaced en dash.
- Non-breaking spaces: keep a number and its unit (10 km, €250), dates and names with titles on one line. In Czech and Slovak they also follow one-letter prepositions and conjunctions so that these never end a line.
- Percentages: English writes 5% without a space; Czech and Slovak write 5 % with a space.
- Quotation marks: English uses “curly quotes”, Czech and Slovak use „these“. Straight quotes "like this" are a keyboard character, not typographic quotes.
- Ellipsis: a single character (…) rather than three full stops.
On Windows, type an en dash with Alt + 0150 and a non-breaking space with Alt + 0160; on macOS, the en dash is Option + hyphen.
Getting typography right on a website
- Non-breaking spaces in HTML: written as . WordPress plugins can add them automatically for Czech and Slovak; custom systems can do it with a simple function when text is saved.
- Hyphenation: the CSS property hyphens: auto only works when the page language is set correctly (for example lang="en").
- Font format: use WOFF2 and only the weights the site actually needs. Each weight is another file to download and slows loading. More in our guide to website speed and Core Web Vitals.
- Self-hosted fonts: fonts served from your own server load without a request to another domain. Check the licence and support for accented characters (latin-ext).
- Test on a phone: check size, line height and line length on a real device, not just a narrowed browser window.
Typography as part of the brand
Next to the logo and colours, the typeface is the most visible part of visual identity. It belongs in the brand manual: which typefaces are used for headings and text, in which weights and sizes, and which fallback fonts to use in emails or documents. Our article on brand identity covers the wider picture.
When to bring in a professional
You can apply the basic rules yourself and see the difference straight away. A professional is worth it when choosing a typeface for a new brand, dealing with font licences or building a site that has to meet WCAG. We design typography as part of our graphic design service and set it up directly in CSS when building websites, so it works on mobile and desktop alike.
Frequently asked questions
What is typography?
Typography is the craft of working with type and setting text. It covers choosing typefaces, size, weight, line height and line length, as well as the rules for dashes, spaces, quotation marks and numbers. Its aim is text that is easy to read and looks consistent.
What are the basic typography rules for websites?
Body text of at least 16 px, line height around 1.5, lines of roughly 75 characters at most, left alignment and a text contrast of at least 4.5:1. Use no more than two typefaces, a clear heading hierarchy and the punctuation conventions of each language.
What is the difference between a hyphen and a dash?
A hyphen (-) is shorter and joins words, as in well-known. An en dash (–) is longer and marks ranges such as 9–17. Keyboards only have the hyphen; on Windows you type an en dash with Alt + 0150, on macOS with Option + hyphen.
Where should a non-breaking space go?
A non-breaking space belongs between a number and its unit, within dates and between a title and a name, so these never split across two lines. In Czech and Slovak it also follows one-letter prepositions and conjunctions. In HTML it is written as .
Which font size should a website use?
Body text should be at least 16 px, which is the default size in browsers. Headings are larger, with a consistent scale across the site. Setting sizes in rem units lets text scale with the reader's browser settings.