HTML <pre> (Preformatted Text) Tag

❮ Previous Reference Next ❯

Example

<pre>This text is formatted
   exactly
      as
         it
      is
typed.</pre>

Meaning

The <pre> element is used to specifies that the enclosed text is preformatted, meaning that spaces, returns, tabs, and other formatting characters are preserved.

Preformatted text generally will be rendered by the browsers in a monospaced font.

Note: Text within the PRE element is formatted. Spaces and carriage returns are preserved.

Version: HTML 3.2, 4, 4.01, 5


Standard Syntax

<pre>...</pre>



Browser Support




Status







Global Attributes

The <pre> element also supports the Global Attributes in HTML.


Event Attributes

The <pre> element also supports the Event Attributes in HTML.




By Default CSS Value(s)

Most of the browsers will display the <pre> element with the following by default value(s)

pre {
  display: block;
  font-family: monospace;
  white-space: pre;
  margin: 1em 0;
}



Related Tags:

<blockquote>, <dd>, <div>, <dl>, <dt>, <figcaption>, <figure>, <hr>, <li>, <ol>, <p> and <ul>
❮ Previous Reference Next ❯