Skip to main content

<code>


  • Date:
    29/04/2024
  • Modified:
    27/05/2026
  • Category:
    Elements

The <code> element holds a block of source code or other technical syntax that must be presented as monospace text.

Notes

  • Use <code> at block level for code samples.
  • For pre-formatted text that is not source code (ASCII art, terminal output, formatted poetry), use <pre> instead.
  • Whitespace and line breaks inside <code> are significant and must be preserved.

Examples

Code block

<code>
function greet(name) {
  return "Hello, " + name + "!";
}

console.log(greet("World"));
</code>

  • Date:
    29/04/2024
  • Modified:
    27/05/2026
  • Category: