Stats

120 Contributors: 6 Monday, May 29, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Marking up computer code

Syntax

  • <pre>Formatted text</pre>
  • <code>Inline Code</code>

Remarks

The code element should be used for any kind of "string that a computer would recognize" (HTML5), for example:

  • source code
  • terms from markup/programming languages (element names, function names, etc.)
  • file names

Related elements

For variables, the var element can be used.

For computer output, the samp element can be used.

For user input, the kbd element can be used.

Related Examples