CKTIS / HTML
pre — preformatted text
The `pre` element represents a text block whose layout carries meaning. Default rendering preserves spaces and line breaks, but its contents are still parsed as HTML.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
<pre>...</pre>pre represents a block of preformatted text. Default browser styles preserve spaces and line breaks and use a monospace font; CSS can change that appearance.
Both tags are required. The element accepts global attributes and phrasing content. pre establishes preformatting; code, samp, and kbd inside it can identify code, program output, and user input respectively.
In HTML syntax, one newline immediately after the opening tag is removed. Contents are still parsed as HTML: write literal < as < and & as & to avoid interpretation as markup or character references.
Spatial layout can be lost in nonvisual presentation. Provide a text description for ASCII art.
Examples
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>Preformatted text</title>
<pre>
x < 3
y & z</pre>
</html>Result
x < 3 y & z
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.