A text line enclosed with <pre> tag should preserve white space and most of the time will pre-format the font (usually Courier).

Generally browsers do following actions

  • May leave white space intact;
  • May render text with a fixed-pitch font;
  • May disable automatic word wrap;
  • Must not disable bidirectional text processing.

Syntax:

<pre></pre>

Attributes:

Example

HTML preformatted text element:

x
 
<html>
<head>
<title>HTML tutorial</title>
</head> 
<body>
<p>Regular text looks like this</p>
<pre>Preformatted text looks like this</pre>
</body>
</html>

 

›› go to examples ››