The white-space
property defines how an element’s white space is handled.
The white-space
property defines whether white space is collapsed and how, as well as whether lines may wrap at soft-wrap opportunities.
p {
white-space: normal;
}
normal
Default value. Multiple whitespaces will collapse into a single whitespace.
nowrap
Multiple whitespaces will collapse into a single whitespace. Text will never wrap to the next line until a <br>
tag forces such.
pre
Whitespace is preserved and will only wrap on line breaks, same as the <pre>
tag in HTML.
pre-line
Multiple whitespaces will collapse into a single whitespace. Text will wrap when necessary and on line breaks.
pre-wrap
Whitespace is preserved by the browser. Text will wrap when necessary and on line breaks.
initial
Sets the property to its default value.
inherit
Inherits this property’s value from its parent item.
Have a code example of white-space
? Submit a codepen.io demo and we'll showcase it here ↴