Reflow, zoom and text spacing
Definition and purpose
Reflow lets content fit a narrower viewport without requiring horizontal and vertical scrolling for ordinary reading. Text resizing and spacing overrides must not destroy content or controls.
Fluid reading area
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; font: 16px sans-serif; color: #172033; background: white; } #a { width: 100%; max-width: 560px; overflow-wrap: anywhere; } </style> </head> <body> <main id="a"> <p>Read this message even when space is limited.</p> <p>Order reference: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</p> </main> </body></html>Width follows the viewport up to a cap, and long tokens can wrap.
Syntax and mental model
WCAG reflow tests ordinary vertically scrolling content at an equivalent width of 320 CSS pixels, with exceptions for inherently two-dimensional content. Text-spacing overrides include line-height 1.5 times font size, paragraph spacing 2 times, letter spacing .12em and word spacing .16em. These are test conditions, not mandatory default styles. Use flexible widths, wrapping and unconstrained block heights. Test both browser zoom and user spacing.
Spacing test
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; font: 16px sans-serif; color: #172033; background: white; } #a { line-height: 1.5; letter-spacing: .12em; word-spacing: .16em; } p { margin-block-end: 2em; } </style> </head> <body> <main id="a"> <p>Read this message even when space is limited.</p> <p>Order reference: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</p> </main> </body></html>Text spacing expands without a fixed clipping height.
Common mistakes
Do not hide overflow to conceal a reflow defect. It can clip information without solving the sizing problem.
Practice and next steps
After trying the examples, complete the linked coding exercise and review questions. Predict the result before running your code. Prerequisite: Keyboard focus and target size. Next lesson: Visual hiding and reading order.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Reflow, zoom and text spacing — knowledge check
Five questions on reflow, zoom and text spacing.
What width is used for ordinary vertical reflow testing?
Which property can break long tokens?
Are text-spacing test values mandatory defaults?
What is wrong with overflow:hidden as a reflow fix?
What should be tested in addition to a narrow viewport?