When you really want to keep those spaces

white-space

Determine how spaces, tabs and newlines are handled within an element.

Property values

Collapse whitespace: how are consecutive sequences of spaces, tabs and newlines are treated? Collapsed into a single space or honored.

Honor newlines: do newlines in the manuscript produce a new line of text?

Overflow right edge: When the next word does not fit into the width of the element, overflow the element's right boundary.

Add new line: When the next word does not fit into the width of the element, automatically add a new line of text.

The possible keywords values and their meanings:

keyword whitespace newlines overflow or add line
normal collapsed no add new line
nowrap collapsed no overflow right edge
pre honored yes overflow right edge
pre-line collapsed yes add new line
pre-wrap honored yes add new line *
break-spaces honored yes add new line *

* pre-wrap does not keep dangling spaces at the right edge, but break-spaces does.

Examples

/* Nothing is collapsed, everything is honored, text doesn't overflow */    

white-space: pre-wrap;
white-space

style > character > white-spaceWhen you really want to keep those spaces

🔎