content logo

Learn HTML:

Html pre tag

The <pre> tag defines a block of preformatted text. This element is commonly used to preserves spaces, line breaks, tabs, and other formatting characters in source markup that web browsers would otherwise ignore.

Text within the <pre> element is typically rendered by the browsers in a monospace (fixed-width) font, such as Courier, but this style can be overridden using CSS.

The example below shows the <pre> tag in action.

<pre>
   The pre
   element preserves      spaces,
   line-breaks, tabs...
</pre>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <pre> tag.

Attribute Value Description
width number Obsolete Specifies the maximum number of characters per line.
#

HTML Pre Example

#

HTML Pre Code

#

HTML Pre Tutorial