white-space
Controls how white space (spaces, tabs, and newlines) inside an element is handled. It can be used to prevent text from wrapping or to preserve multiple spaces and line breaks.
Quick example
.code-block {
white-space: pre;
font-family: monospace;
/* preserves all spaces and line breaks exactly as typed */
}Quick facts
Initial value
normalInherited
Yes
Applies to
all elements
Animation type
discrete
Values
normalprepre-wrappre-linewhite-space-collapsetext-wrap-modewhite-space Browser Support
Widely availableSince 201596% global usage
This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.
Safe to use without fallbacks.
1+
1+
1+
12+