property

white-space — CSS reference

Controls whitespace processing and wrap permission. Initial normal and inherited. Pre preserves whitespace without soft wrapping, pre-wrap allows wrapping, and pre-line collapses spaces but preserves segment breaks.

Formal Syntax & Structure

css syntaxcss
normal | pre | pre-wrap | pre-line | <white-space-collapse> || <text-wrap-mode> (selected)

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>Text geometry lab</title><style>#a,#b{width:80px;font:16px/20px monospace;margin:0}#a{white-space:pre-wrap}#b{white-space:pre}</style><body><p id="a">one two three four</p><p id="b">one two three four</p></body></html>
CSS Reference