basforge

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

    RU

    Text on screen goes left-aligned, not justified

    Align site text to the left, not to both edges: by default the browser doesn’t hyphenate, so to line up both edges it stretches the spaces — and white “rivers” run through the paragraph. Center only one or two lines: a heading, a caption, a button.

    Why not justified

    In a book, justification works because the typesetter or the software places hyphens and balances spacing across the whole paragraph. In a browser hyphenation is off by default (hyphens: manual), and long words — “configuration”, “authentication” — move to the next line whole. The spaces left on the line stretch several times over, and vertical white streaks form across lines.

    On a phone it’s worse: a line holds 35 characters, and one long word leaves three words on a line with huge gaps. WCAG 1.4.8 (AAA) lists this among its conditions for blocks of text: no justification.

    Why not centered

    Centered lines have a ragged left edge — every line starts in a new place, and the eye looks for the start again. For a one- or two-line heading that’s unnoticeable; for a paragraph it isn’t.

    If you do need justification

    text-align: justify together with hyphens: auto and a lang attribute on the page: the browser hyphenates by dictionary, and the spaces stretch less. Chrome, Firefox and Safari all ship an English hyphenation dictionary. The price is frequent hyphens, and they can only be controlled per element as a whole: code gets hyphens: none. For a website the gain is one even right edge.