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

Live Demo
<!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 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

html_tags_reference.htm

Advertisements