white-space
white-space property is used to control the flow and formatting of text in CSS.
Syntax
The white-space property is specified as a single keyword chosen from the list of values below.
Values
normal
Sequences of whitespace are collapsed. Newline characters in the source are handled as other whitespace. Breaks lines as necessary to fill line boxes.
nowrap
Collapses whitespace as for normal, but suppresses line breaks (text wrapping) within text.
pre
Sequences of whitespace are preserved. Lines are only broken at newline characters in the source and at <br>
elements.
pre-wrap
Sequences of whitespace are preserved. Lines are broken at newline characters, at <br>
, and as necessary to fill line boxes.
pre-line
Sequences of whitespace are collapsed. Lines are broken at newline characters, at <br>
, and as necessary to fill line boxes.
Example
/* Keyword values */
white-space: normal;
white-space: nowrap;
white-space: pre;
white-space: pre-wrap;
white-space: pre-line;
/* Global values */
white-space: inherit;
white-space: initial;
white-space: unset;