HTML <pre> Tag
<pre>
Here is some
PREFORMATTED text,
see how it...
works?
</pre>
<p>
Here is some
NORMAL paragraph text,
see how it...
works?
</p>
The above example demonstrates usage of the <pre>
element.
The <pre>
element represents a block of preformatted text. Any contents of the <pre>
element are formatted exactly as they are entered by the author.
For example, if the author enters ten spaces before a word, those ten spaces will be rendered as such. If she enters five carriage returns, those five carriage returns will be rendered. If she didn't use the <pre>
element, those spaces and carriage returns would be ignored by the browser. This is because the browser would need to see the appropriate HTML markup (or character entity) for a non-breaking space or carriage return in order to render those to the user. The <pre>
tag allows you to bypass that requirement.
Browsers typically render <pre>
text in a mono-spaced font (such as Courier).
The <pre>
element is often used in conjunction with the the <code>
element when marking up computer code.