<pre>
The preformatted text element renders content exactly as written, preserving whitespace and line breaks.
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
| Environment | Since version |
|---|---|
| chrome | 1.0 |
| firefox | 1.0 |
| safari | 1.0 |
| edge | 12 |