Property white-space-collapse
The white-space-collapse CSS property controls how white space inside an element is collapsed.
Syntax
/* Keyword values */ white-space-collapse: collapse; white-space-collapse: preserve; white-space-collapse: preserve-breaks; white-space-collapse: preserve-spaces; white-space-collapse: break-spaces;
/* Global values */ white-space-collapse: inherit; white-space-collapse: initial; white-space-collapse: revert; white-space-collapse: revert-layer; white-space-collapse: unset;
Collapsing of white space
User agents handle white space collapsing as follows:
- Tabs are generally converted to spaces.
- If segment breaks are to be collapsed:
- Sequences of segment breaks are collapsed down to a single segment break.
- They are converted to spaces in the case of languages that separate words with spaces (like English), or removed altogether in the case of languages that do not separate words with spaces (like Chinese).
- If spaces are to be collapsed:
- Spaces or tabs before or after segment breaks are removed.
- Sequences of spaces are converted, or “collapsed”, to a single space.
- When spaces are preserved, sequences of spaces are treated as non-breaking except that they will soft-wrap at the end of each sequence — i.e. the next line will always start with the next non-space character. In the case of the break-spaces value however, a soft wrap could potentially occur after each space, so the next line may start with one or more spaces.