HTML pre Tag

HTML<pre>Tag: The HTML<pre> tag specifies the preformatted text which preserves the text spaces, line breaks, tabs, and other formatting characters which are ignored by web browsers. And the text in the <pre> element is displayed in a fixed-width font, but it can be changed using CSS. The <pre> tag requires a starting and end tag.

HTML<pre>Tag

This HTML pre tag supports both the global and the event attributes. And the text within this element is displayed in a monospace font. HTML 4 is supports all the attributes of <pre> tag.

Syntax: <pre> Text </pre>



Browser compatibility

The HTML<pre> tag is supported by different types of browsers.

  • Chrome
  • Firefox
  • Opera
  • Safari
  • Internet Explorer

Example:

<!DOCTYPE html>
<html>
<body>
<pre>
FRESHERSNOW TUTORIALS-Learn Tutorials
For Free. For Everyone. Forever.
</pre>
</body>
</html>

Output:

FRESHERSNOW TUTORIALS-Learn Tutorials
For Free. For Everyone. Forever.

Attributes that are supported by the <pre> tag

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