Skip to main content

html-tags.com

<pre>

Preformatted text where whitespace and line breaks are content.

Baseline: Widely available · Grouping content

When to use it

For code blocks (wrap the code in a code element), terminal transcripts, ASCII diagrams.

When not to

Give wide pre blocks their own horizontal scroll (overflow-x) rather than letting the page scroll sideways.

Example

sx --format html --out guide.html chapter-*.md
<pre><code>sx --format html --out guide.html chapter-*.md</code></pre>
Rendered live above, source below.

Authoritative references