: The CODE Element
Last updated: 2026-09-12
<code>The CODE Element
Marks a fragment of computer code, rendered in a monospace font by default.
| Category | Formatting |
|---|---|
| Content Model | Phrasing content |
| Allowed Parents | Any element that accepts phrasing content |
| Content Tag | Yes — requires closing </code> tag |
| Status | Standard |
📝 Syntax
<code>code snippet</code>
▶ Example
Edit the code below and see the live result in the playground:
🌐 Browser Support
| Browser | |||||
|---|---|---|---|---|---|
| <code> | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported in all major browsers | |||||
Tip: For multi-line code, wrap <code> inside <pre> to preserve line breaks and indentation.