HTML pre tag
HTML

HTML pre tag

Editorial Team
Editorial Team

Follow us on Discord or Telegram to get access to free tutorials and updates.

The <pre> tag represents preformatted text in an HTML document. The pre tag preserver both spaces and line breaks.

Syntax

<pre>Some text here</pre>

Attributes

AttributeValueDescription
widthnumberNot supported in HTML 5

This tag supports all HTML global attributes and HTML event attributes.

Example

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <pre>This is an example for
pre fromated text. This tag preserves
both
spaces      and
line breakes.
    </pre>
</body>
</html>

Output

This is an example for
pre fromated text. This tag preserves
both
spaces      and
line breakes.