Tell a Friend About Our Cool Software

You learned in Chapter 2 how HTML normalized white space in your
document. Any white space in your content--spaces, tabs, and new lines-
-is collapsed to a single space. This works well in most situations, but there
are times when you have text that you want displayed exactly as-it, white
space and all. An example might be a poem that has been carefully laid
out with spaces and tabs to get the exact indentation that the author
wants. In this situation use the <pre> tag, which stands for preformatted.
White space is not normalized within <pre> tags--it is displayed exactly
as entered. The <pre> tag also forces the browser to use a monospaced
font, in which all characters are the same width.
The following HTML will demonstrate this. It contains two paragraphs that are identical except that the second one uses the <pre> tag to preserve white space. Figure 3-4 shows how this HTML is rendered.
<body>
<p>one
two three
four
five
</p>
<p><pre>one
two three
four
five
</pre></p>
</body>
Figure 3-4. Use the <pre> tag to display content with white space preserved and in a monospaced font.