From http://www.w3schools.com (Copyright Refsnes Data)

HTML <pre> tag


Example

Preformatted text:

<pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both      spaces and
line breaks
</pre>

Try it yourself!


Definition and Usage

The <pre> tag defines preformatted text.

Text in a pre element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The <pre> tag is supported in all major browsers.


Differences Between HTML and XHTML

The "width" attribute of the pre element was deprecated in HTML 4.01, and is not supported in XHTML 1.0 Strict DTD.


Tips and Notes

Tip: Use the pre element to display computer code!


Optional Attributes

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

Attribute Value Description DTD
width number Deprecated. Use styles instead.
Specifies the maximum number of characters per line
TF

Standard Attributes

id, class, title, style, dir, lang, xml:lang, xml:space

For a full description, go to Standard Attributes.

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

For a full description, go to Event Attributes.


From http://www.w3schools.com (Copyright Refsnes Data)