HTML - <pre> Tag



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.


<!DOCTYPE html>

      <title>HTML pre Tag</title>

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


This will produce the following result −

Global Attributes

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

Specific Attributes

The HTML <pre> tag also supports the following additional attributes −

Attribute Value Description
width number Deprecated − 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

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes