HTML <pre> Tag


Preformatted text is defined by the HTML <pre> tag, which preserves both whitespace and line breaks in the HTML content.

The <pre> element is another frequent name for this tag.

Syntax

 
<pre> Contents here... </pre>

Example

x
 
<!DOCTYPE html>
<html>
<body>
<pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both      spaces and
line breaks
</pre>
</body>
</html>
Preview

Supported Browsers

Element Chrome Firefox Safari Edge / IE Opera
<pre> Yes Yes Yes Yes Yes