The normal value treats text
normally, with consecutive spaces collapsing to one. The pre value displays multiple characters, like
the pre element in (X)HTML, except
that it has no effect on the font of the element (browsers tend to
display pre elements in the
monospace font).
Figure 18-21 shows a
simple use of the white-space
property as specified in this example style and markup.
p.haiku {white-space: pre; }
<p class="haiku">
Love's pure silver flame
gives each innermost spirit
invisible warmth.
</p>
Figure 18-21. The white-space property
nowrap prevents the text
element from wrapping unless designated by a <br />. Without a <br />, the text may extend beyond the
browser window, requiring horizontal scrolling.
CSS 2.1 introduced two new values for white-space. The pre-wrap value preserves multiple character
spaces but allows long lines of text to wrap. Line breaks in the
source are also honored. The pre-line value makes multiple character
spaces collapse to one, but it preserves new lines in the source. As
of this writing, no browser supports the pre-line and pre-wrap values for white-space.