Skip to main content

html-tags.com

<code>

A fragment of computer code: an element name, a function, a filename, a command.

Baseline: Widely available · Inline text semantics

When to use it

Inline for code tokens in prose; wrap in pre for block listings.

When not to

Not for keyboard input (kbd), program output (samp), or placeholders (var) — each has its own element.

Example

Query it with document.querySelector('main').

<p>Query it with <code>document.querySelector('main')</code>.</p>
Rendered live above, source below.

Authoritative references