HTML Code - how to use <code> tag

The <code> tag is a phrase tag and is used to define computer code. It is usually displayed in monospace font.


The <code> tag supports the global and event attributes.


<p><code>Computer code</code> is formatted using the code element</p>

Computer code is formatted using the code element

Related HTML tags:

  • <samp> - used to display sample output from a computer program
  • <kbd> - used to display keyboard input
  • <var> - used to display a variable