HTML Preformatted Tag

The <pre> tag is useful for text which has already been formatted. Generally text such as computer code is wrapped in the <pre> tag to keep the formatting. The <code> tag is also used for computer code.

Example

<pre>
20 Example Steet
  United Kingdom
London, WX3 288</pre>

Output

20 Example Steet
  United Kingdom
London, WX3 288

The formatting has been kept the same, and if you view the source you will see there are no <br> or <p> tags to split up the text. The <pre> tag tells the browser not to reformat the text.

Sponsored Links

Example 2

20 Example Steet

United Kingdom

London, WX3 288

The second example has <p> tags to split the text as well as nbsp; for white-space. The pre tag will keep your copied text as it is: the line breaks, white space etc. Generally browsers will render text in a <pre> tag in small font and mono-space font.