Websites and banners, made understandableImages · Code · WordPress
Home / Guides
HTML & design

Readable articles: line length, rhythm and contrast

An attractive font cannot fix a dense wall of text. Readers need useful headings, identifiable links and comfortable line lengths.

Before you begin

Use a real long article containing a table, list and image. A short placeholder heading will not reveal genuine content problems.

Readable articles: line length, rhythm and contrast. Meaningful structure → Comfortable measure → Contrast and zoom
Meaningful structure → Comfortable measure → Contrast and zoom
Text explanation of the diagram

Meaningful structure → Comfortable measure → Contrast and zoom. A 65ch column does not guarantee exactly 65 letters per line: the unit follows the chosen font’s zero glyph. It is a testing starting point, not a universal rule.

The procedure

  1. Limit the reading column, with 65ch as a possible starting point. Choose type size and line height, then inspect real Russian, Ukrainian and English passages.
  2. Organise by tasks. Headings describe answers; lists communicate sequence or choice. Links should remain identifiable without mouse hover.
  3. Test at 360 px, on a wide screen and at 200% zoom. Retain table headers and provide usable narrow-screen reading rather than shrinking every cell to microscopic text.
Code example
.prose { max-width: 65ch; font-size: 1.125rem; line-height: 1.7; }
.prose a { text-decoration: underline; text-underline-offset: .2em; }

A worked example

A 65ch column does not guarantee exactly 65 letters per line: the unit follows the chosen font’s zero glyph. It is a testing starting point, not a universal rule.

Check the result

No words are clipped, letters do not collide and focus remains visible. Check contrast for body text, links and secondary captions.

A common mistake

A pale caption can technically exist while being impractical to read. Inspect computed colours and their contrast ratio.

Sources and next steps

Diagram and examples: Web Article. The diagram explains a principle; it is not an interface capture or a software test result.

Keep making

A theme that preserves a choice and explains failure

The example changes only the learning panel below. System mode follows prefers-color-scheme; an explicit choice takes precedence and uses one localStorage key on this origin. This does not change the whole website theme.

  1. Choose Dark with the keyboard: Tab moves focus and arrow keys change the native select. Focus must stay visible, with distinguishable text and links.
  2. Reload the page: the saved choice should return. System follows the device preference again; a system preference change updates the panel when that mode is selected.
  3. Choose Test invalid value: an unexpected string is written to the learning key. The panel explains the problem and uses the system theme, without accepting the string as a valid choice. Choose a valid mode again.
  4. Enable simulated write denial, change the mode and read the message. The current page changes visually, but storage success is not claimed. Clear the checkbox and reset: only the learning key is removed.

Reading sample

Check the body text, underlined link, status message and keyboard focus in both modes.

Why contrast matters

The example needs JavaScript; the procedure and source remain available below.

Browser policy can make localStorage unavailable. Theme changes and storage errors are handled separately. The learning checkbox does not change browser permissions. No choice is sent to a server; the browser stores it for this origin. The three language versions share one key.

Complete example JavaScript · prefers-color-scheme · WCAG 2.2 · Contrast Minimum

Valid system, light and dark values control the display. An unknown string uses system mode with a warning; denied storage retains a temporary choice with an error message.
Original theme-choice diagram. © Web Article · CC BY 4.0.

MDN · Window.localStorage

Show a form error and keep the entered values

Imagine a form for choosing supplies for a mock-up. An error in sheet count should leave the selected size intact. This exercise runs in the browser. Use fictional values. The page neither sends nor stores them.

  1. Leave the count empty and choose “Check”. Look for the message next to the field and check that focus moves there. Make sure A3 is still present.
  2. Enter 0, 13 or 2.5. Each should be rejected and remain visible for editing.
  3. Enter 1 or 12 and try again. The error clears, the success status appears and both field values remain in place.

Enter a whole number from 1 to 12.

View HTML and download JS/CSS
<form id="retry-demo" novalidate data-error="Enter a whole number of sheets from 1 to 12." data-success="Validation passed. Both values remain in the fields.">
  <label for="retry-title">Mock-up size</label>
  <input id="retry-title" type="text" autocomplete="off" value="A3">
  <label for="retry-count">Number of sheets</label>
  <input id="retry-count" type="text" inputmode="numeric" autocomplete="off"
         required aria-describedby="retry-hint retry-error">
  <p id="retry-hint">Enter a whole number from 1 to 12.</p>
  <p id="retry-error" role="alert"></p>
  <button type="submit" disabled>Check</button>
  <p id="retry-status" role="status"></p>
</form>

JavaScript · CSS

For your own copy, retain the filenames, link the CSS and JavaScript from the same site and add defer to the script element. For a real submission, also validate on the server and preserve safe field values when redisplaying the form.

The form checks the value, identifies the field with an error and lets the reader retry without losing input.
1. Check. 2. Show the error beside the field. 3. Correct and retry. Web Article diagram · CC BY 4.0.

W3C WAI · Forms Tutorial · User Notification

Read the article through its heading list

Compare the headings before and after the repair. A bold paragraph does not appear in the heading list. Replace it with an h2 alongside the photographs section.

Photographs

Tab to the Diagrams link and press Enter. The fragment in the address should point to the diagrams heading. The before and after examples below are complete HTML files you can copy into an editor.

Diagrams

Before

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Choosing a format</title>
<main>
<h1>Choosing a format</h1>
<nav aria-label="Article sections">
<a href="#photo">Photographs</a> · <a href="#diagram">Diagrams</a>
</nav>
<h2 id="photo">Photographs</h2>
<h3>Compression</h3>
<p>Compare two images of the same size.</p>
<p id="diagram">
<strong>Diagrams</strong>
</p>
<p>Start by checking whether the lines are legible.</p>
</main>
</html>

After

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Choosing a format</title>
<main>
<h1>Choosing a format</h1>
<nav aria-label="Article sections">
<a href="#photo">Photographs</a> · <a href="#diagram">Diagrams</a>
</nav>
<h2 id="photo">Photographs</h2>
<h3>Compression</h3>
<p>Compare two images of the same size.</p>
<h2 id="diagram">Diagrams</h2>
<p>Start by checking whether the lines are legible.</p>
</main>
</html>
h1 · Choosing a format / Article starts / h2 · Photographs / h3 · Compression / h2 · Diagrams / Second peer section
h2 · Diagrams: Second peer section. © web-article.com.ua · CC BY 4.0.

W3C WAI · Headings