<pre>

The preformatted text element renders content exactly as written, preserving whitespace and line breaks.

Since HTML 2.0 Spec ↗

Syntax

<pre>...</pre>

Examples

<pre><code>function add(a, b) {
  return a + b;
}</code></pre>
Output
Renders the multi-line code block with original indentation and line breaks intact in a monospace font.

Notes

Whitespace is significant; leading newlines inside <pre> are rendered. Pair with <code> for code listings and apply overflow-x:auto to prevent layout overflow.

Browser & runtime support

EnvironmentSince version
chrome 1.0
firefox 1.0
safari 1.0
edge 12

See also