HTML5 <pre> Tag

Example

Pre formatted 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.


Differences Between HTML 4.01 and HTML5

The "width" attribute was deprecated in HTML 4.01, and is not supported in HTML5.


Tips and Notes

Tip: Use the <pre> element when displaying text with unusual formatting, or some sort of computer code.


Standard Attributes

The <pre> tag also supports the Standard Attributes in HTML5.


Event Attributes

The <pre> tag also supports the Event Attributes in HTML5.