Using Preformatted Text

Usually, browsers collapse all extra returns and spaces and automatically break lines according to the size of the window. Preformatted text lets you maintain the original line breaks and spacing that you’ve inserted in the text. It is ideal for computer code examples.

To use preformatted text:

1.
Type <pre>.
2.
Type or copy the text that you wish to display as is, with all the necessary spaces, returns, and line breaks.
3.
Type </pre>.
Figure 4.9. The pre element is ideal for text that contains important spaces and line breaks, like the chunk of Perl CGI code shown above.

Figure 4.10. Notice how the line breaks, ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.