The HTML <code> tag is used for indicating a piece of code. The code tag surrounds the code being marked up.

Browsers often display, by default, text surrounded by <code> tags in a monospaced font (also called a fixed-width or non-proportional font) such as Courier.

Multiple lines of code can be marked up by surrounding the <code> tags with <pre> tags.

Required Attributes

  • None.

Optional Attributes

Example

<p>When you call the <code>activate()</code> method on the
<code>robotSnowman</code> object, the eyes glow.</p>

Changes in HTML5

  • None.

Related Tags