Name

pre — HTML 4.01 | HTML5

Synopsis

<pre> . . . </pre>

Delimits “preformatted” text, meaning that lines are displayed exactly as they are typed in, honoring whitespace such as multiple character spaces and line breaks. By default, text within a pre element is displayed in a monospace font such as Courier. The example below would be rendered about the same in the browser as it appears in this book.

Start/End Tags

Required/Required

Attributes

Core, Internationalization, Events, HTML5 Global Attributes

width="number"

Deprecated. Not in HTML5. This optional attribute determines how many characters to fit on a single line within the pre block.

xml:space="preserve"

XHTML only. Instructs XML processors to preserve the whitespace in the element.

Example

<pre>
This is               an             example of

       text with a          lot of
                            curious
                            whitespace.
</pre>

Get HTML & XHTML Pocket Reference, 4th Edition 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.