HTML Dog
Skip to navigation

HTML Tag: pre

Preformatted text. All of the whitespace within this element is regarded as semantically relevant (whereas other elements will consider the likes of indentations or multiple consecutive spaces to be meaningless).

Commonly used to format computer code because it maintains nesting indentations.

Optional Attributes

Global attributes

Example


<pre><code class="html">
&lt;html lang="en"&gt;
    &lt;head&gt;
        &lt;title&gt;HTML, baby!&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;!-- indented code, etc. --&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>