HTML <pre> Tag

Advertisements


Description

The HTML <pre> tag is used for indicating preformatted text. The code tag surrounds the code being marked up.

Browsers normally render pre text in a fixed-pitched font, with whitespace in tact, and without word wrap.

Example

<!DOCTYPE html>
<html>
<head>
<title>HTML pre Tag</title>
</head>
<body>
<pre>
      This text is
 in a fixed-pitch
        font, and it preserves
 both    spaces and line breaks
</pre>
</body>
</html>

This will produce following result:

      This text is
 in a fixed-pitch
        font, and it preserves
 both    spaces and line breaks

Global Attributes

This tag supports all the global attributes described in - HTML Attribute Reference

Specific Attributes

The HTML <pre> tag also supports following additional attributes:

AttributeValueDescription
widthnumberDeprecated: It specifies the desired width of the pre-formatted text.

Event Attributes

This tag supports all the event attributes described in - HTML Events Reference

Browser Support

ChromeFirefoxIEOperaSafariAndroid
YesYesYesYesYesYes

html_tags_reference.htm