The white-space-collapse property controls how whitespace characters collapse. A longhand of white-space (along with text-wrap-mode). collapse: collapses spaces; preserve: keeps like <pre>; preserve-breaks: keeps only newlines..code {
white-space-collapse: preserve;
}.chat {
white-space-collapse: preserve-breaks;
text-wrap-mode: wrap;
}collapseThe default value. Sequences of whitespace collapse to a single space, newlines treated as space.preservePreserves all whitespace and newlines from source (like <pre>).preserve-breaksCollapses whitespace, but preserves newlines.preserve-spacesPreserves whitespace, but newlines treated as spaces.break-spacesPreserves whitespace and newlines, with trailing spaces forcing breaks.discardRemoves all whitespace characters entirely.CSS Text Module Level 4Editor's DraftW3CMDNIn the beginning God created the heavens and the earth.
Now the earth was formless and empty, darkness was over the surface of the deep, and the Spirit of God was hovering over the waters.
And God said, “Let there be light,” and there was light.
Show all codeEdit CSS onlineThe plugin that remembers hundreds of CSS items for youEvery CSS property — in a live demonstrationThe bilingual CSS referencedefinitionexamplessyntaxmodulespecificationsourcesvisual demonstrationpreviousnext