basforge

Search titles, text and the “If it doesn’t work” cases.

    RU

    Typography: typeface, size and the line on screen

    Text readability on screen rests on four settings — typeface, font size, line height and line length — plus typesetting rules: curly quotes, dashes, non-breaking spaces. Pick a typeface that covers your languages and has tall lowercase letters, and tune the size to the typeface instead of copying it from someone else’s CSS: at the same 17 px, Times New Roman’s lowercase is 15% shorter than Golos’s.

    What problem it solves

    Typography decides how much effort goes into reading itself: telling letters apart, holding the line, finding the start of the next one. The content is the same, but the fatigue by the third screen differs.

    Without typography

    • 14 px in light gray #999 on white — 2.85:1
    • a line across a 1920 px monitor, about 195 characters
    • the default line height, normal
    • basic Latin in your font, accented letters in a fallback
    • “straight quotes” and a hyphen instead of a dash

    With typography

    • 17 px, text #1a1816 on #f4f2ee — 15.8:1
    • a 42em column, about 76 characters per line
    • a line height of 1.7
    • one font that covers the whole text
    • “curly quotes”, a proper dash and a non-breaking space where needed

    What a line is made of

    Setting What it is Guideline Details
    font size, font-size the height of the box a letter sits on — not the height of the letter itself 15–25 px for screen text (Butterick); the browser default is 16 px, here 17 px below
    x-height the height of the letter “x”: the eye judges a font’s size by it at 17 px, from 7.65 to 9.27 px depending on the font below
    line height, line-height the distance between the baselines of neighbouring lines 1.5–1.7 for long text White space in CSS
    line length characters per line, spaces included 45–80 Line length
    alignment how lines meet the column’s edges left-aligned Left-aligned

    Font size isn’t letter size

    The font size sets a box for the letter with room for ascenders and descenders: the tail of “y”, the top of “b”. How much of that box the lowercase letters fill is up to the typeface. Measured in Edge 155 at 17 px on the same paragraph (a Russian one):

    Typeface x-height Paragraph width, Golos = 100%
    Verdana 9.27 px 108%
    Golos Text — this site’s font 9.01 px 100%
    Arial 8.84 px 96%
    Segoe UI 8.50 px 94%
    Georgia 8.16 px 95%
    Times New Roman 7.65 px 87%

    Times New Roman’s lowercase is 15% shorter than Golos’s: to look as large, it needs about 20 px. That’s why the font size, line length and line height are tuned to a specific typeface and retuned when the typeface changes. If the fallback fonts are noticeably smaller than the main one, font-size-adjust: 0.53 evens them out — Golos’s x-height as a fraction of the font size: Chrome since version 127, Safari since 16.4, Firefox for a long time.

    Which typeface to use

    If… Use
    you need the text to look the same on every system your own web font
    you want text with no downloads, looking “native” the system stack
    you need two or three weights of one typeface a variable file
    code, commands, aligned columns of characters a monospace font
    headings, a logo a display face

    Your own font is a woff2 file with the scripts you need, served from your own site (A font on a site). The system stack system-ui, sans-serif downloads nothing: on Windows it’s Segoe UI, on macOS and iOS San Francisco, on Android Roboto, and each has its own text width. A variable file carries a range of weights: here Golos’s weights 400–700 sit in one file, 22 KB for Cyrillic. In a monospace font every character has the same width, and l, 1 and I are distinct — here that’s JetBrains Mono. A display face is for large sizes only: Unbounded is on h1 and the shelf plates, not in body text.

    Serif or sans hardly matters for reading speed on screen: in Arditi and Cho’s experiment (2005) serifs didn’t change reading speed. What matters more is the x-height and full coverage of the characters you’ll use: accented letters, №, €, whatever turns up in the text. A font missing them gets patched by a fallback, and one word ends up in two fonts.

    Sizes: the base and the scale

    The sizes on this site are an example of three levels of importance (Three levels of importance):

    What Size Font
    the page h1 up to 44 px Unbounded 600
    h2 from 21 to 27 px: clamp(21px, 2.2vw, 27px) Golos 700
    h3 19 px Golos 700
    text 17 px Golos 400
    tags 11 px, uppercase JetBrains Mono

    clamp() grows the heading with the window: below 955 px wide an h2 is 21 px, from 1227 px it’s 27 px, and in between 2.2% of the window width. Tags differ from text in three ways at once: size, capitals and the monospace font.

    A size in rem follows the browser’s font size setting; in px it follows only page zoom. Someone who set a large font in their browser won’t see it on a site sized in px.

    Typesetting: quotes, dashes, spaces

    These characters aren’t on the keyboard, so they get skipped — and text without them looks rushed. On Windows the codes are typed on the numeric keypad while holding Alt; on macOS there are Option shortcuts.

    Character Where Windows macOS HTML
    “double quotes” quotation marks in English text Alt+0147, Alt+0148 Option+[, Option+Shift+[ “ ”
    ‘single quotes’ quotes inside quotes: “the ‘Network’ item” Alt+0145, Alt+0146 Option+], Option+Shift+] ‘ ’
    ’ apostrophe it’s, don’t — the same character as the closing single quote Alt+0146 Option+Shift+] ’
    — em dash between parts of a sentence: no spaces in US style, spaced in British Alt+0151 Option+Shift+- —
    – en dash a range of numbers, without spaces: 45–80 Alt+0150 Option+- –
    - hyphen inside a word: “web-safe” the - key the - key -
    − minus a negative number: −5 no code, only a layout Character Viewer −
    non-breaking space between a number and its unit: 17 px Alt+0160 Option+Space  

    Automatic hyphenation by dictionary is turned on by hyphens: auto with lang="en" on the page (Left-aligned); a single word on a paragraph’s last line is fixed by text-wrap: pretty (White space in CSS).

    In code, commands and configs it’s the opposite: only straight quotes " and the hyphen -. Autocorrect in word processors turns -- into a dash and " into curly quotes, and a copied command with —force instead of --force won’t work. That’s why commands are published as code blocks, where there’s no autocorrect (Code as text).

    What you get and what it costs

    What you get

    • The line doesn’t get lost. At 45–80 characters and a line height of 1.5–1.7, the eye returns to the start of the next line without skipping one (Line length).
    • Your own font looks the same everywhere. The system stack differs per system: in Segoe UI the same paragraph is 6% narrower than in Golos, and a column tuned for 76 characters on one system holds a different number on another.
    • Lines don’t break in random places. A non-breaking space keeps “17 px” together, and text-wrap: balance splits a heading into equal lines.
    • Numbers compare at a glance. With tabular-nums, digits in a column line up by place.

    What it costs

    • Your own font is a download. On a Russian page of this site Golos is two files: 22 KB of Cyrillic and 38 KB of Latin. The Latin one is needed there too: it holds the space, digits, quotes and dashes. While the files download, the fallback draws the text.
    • Sizes are tied to the typeface. The font size, line height and column width were tuned for Golos; another typeface means tuning again.
    • Typesetting takes effort. Dashes and non-breaking spaces aren’t printed on the keys: without a layout or an auto-typographer they get skipped.
    • Typographic characters break code. A curly quote or a dash that slips into a command is a different character, and the shell doesn’t understand it.

    Where to start

    If it doesn’t work

    On load the text appears in one font, then jumps to another, and paragraphs shift

    Cause
    font-display: swap: while your font downloads, the fallback draws the text. The fallback has a different width and line height, and after the swap the lines wrap differently.
    Fix
    Tune the fallback to your font — size-adjust and ascent-override in its @font-face — and preload the main file (A font on a site).

    Basic Latin letters are in your font, and accented or non-Latin ones in another, Arial-like font

    Cause
    The font lacks those characters, or only the latin subset is loaded: for the missing letters the browser takes the next font in font-family.
    Fix
    Check that the font covers the characters, and load the subsets you need — latin-ext, cyrillic: in Astro, subsets: ['latin', 'cyrillic']; Google Fonts CSS served by URL includes all of a font’s subsets itself.

    Bold looks smeared, and italic looks like upright letters slanted

    Cause
    The needed style isn’t among the loaded files, and the browser fakes it: thickens the outline or slants the upright letters. Golos Text has no italic at all.
    Fix
    Load the style or do without it. font-synthesis: none forbids faking — you see at once which file is missing.

    On an iPhone the page zooms in when you tap an input field

    Cause
    Safari on iOS zooms into a field if its text is smaller than 16 px.
    Fix
    Give input fields font-size: 16px (1rem) or more. Don’t set user-scalable=no: then people who can’t read without zooming won’t be able to zoom either.

    Figures in a table column don’t line up

    Cause
    In Golos, as in many text fonts, figures have different widths by default: the one is 22% narrower than the zero, and 111 is shorter than 000.
    Fix
    Give number columns font-variant-numeric: tabular-nums: all figures get the same width. It works if the font has tabular figures.

    A dash ended up at the start of a line, and “px” on a line without its number

    Cause
    There’s an ordinary space before the dash or between the number and the unit, and the browser breaks the line there.
    Fix
    Use a non-breaking space:   in HTML, Alt+0160 on Windows.