Preformatted Text and Code
The <pre> element displays text in a fixed-width font and preserves whitespace — spaces, tabs, and line breaks appear exactly as written in the HTML source. It is ideal for ASCII art or any content where spacing is meaningful.
Inline and Block Code
Use <code> for inline snippets of computer code within a sentence. For multi-line code blocks, wrap <code> inside <pre>. The <kbd> element represents keyboard input, <samp> represents sample output, and <var> represents a variable name.
<pre>— Preserves whitespace<code>— Inline code fragment<kbd>— Keyboard input<samp>— Sample output<var>— Variable name