white-space
The white-space property specifies how whitespace is handled.
Formal Syntax
normal | pre | pre-wrap | pre-line | <'white-space-collapse'> || <'text-wrap-mode'> || <'white-space-trim'>
JavaScript Access
// Access via element.style
element.style.whiteSpace = 'normal';
Browser Support
| Feature | Chrome | Firefox | Safari | Edge |
|---|---|---|---|---|
| white-space | 1 | 1 | 1 | 12 |
| break-spaces | 76 | 69 | 13.1 | 79 |
| collapse | 114 | 124 | 18 | 114 |
| normal | 1 | 1 | 1 | 12 |
| nowrap | 1 | 1 | 1 | 12 |
| pre | 1 | 1 | 1 | 12 |
| pre-line | 1 | 3.5 | 3 | 12 |
| pre-wrap | 1 | 3 | 3 | 12 |
| preserve | 114 | 124 | 18 | 114 |
| preserve-breaks | 114 | 124 | 18 | 114 |
| preserve-spaces | — | 124 | — | — |
| shorthand_values | 114 | 124 | — | 114 |
| svg_elements | — | 36 | — | 12 |
| textarea_support | 1 | 36 | 1 | 12 |
| wrap | 114 | 124 | 18 | 114 |
Related Properties
- alignment-baseline
- baseline-shift
- baseline-source
- color
- dominant-baseline
- hanging-punctuation
- hyphenate-character
- hyphenate-limit-chars
- hyphens
- initial-letter
- letter-spacing
- line-break
- line-clamp
- line-height
- orphans
- overflow-wrap
- quotes
- ruby-align
- ruby-overhang
- ruby-position
- tab-size
- text-align
- text-align-last
- text-anchor
- text-autospace
- text-box
- text-box-edge
- text-box-trim
- text-indent
- text-justify
- text-overflow
- text-rendering
- text-transform
- text-wrap
- text-wrap-mode
- text-wrap-style
- vertical-align
- white-space-collapse
- widows
- word-break
- word-spacing
- text-size-adjust 🧪
- text-spacing-trim 🧪
- hyphenate-limit-last 🚧
- hyphenate-limit-lines 🚧
- hyphenate-limit-zone 🚧
- initial-letter-align 🚧
- initial-letter-wrap 🚧
- line-fit-edge 🚧
- line-grid 🚧
- line-height-step 🚧
- line-padding 🚧
- line-snap 🚧
- ruby-merge 🚧
- text-align-all 🚧
- text-group-align 🚧
- text-spacing 🚧
- white-space-trim 🚧
- word-space-transform 🚧
- word-wrap 🚧