HTML <code> tag

Updated: 11/13/2018 by Computer Hope
HTML code tag

The HTML <code> tag is an inline HTML (hypertext markup language) element used to designate that a section of text is computer code. The following sections contain information about this tag, including an example of it in use, and related attributes, browser compatibility.

Note

This element is unique in that it is a phrase tag, which indicates that a section of text has structural meaning.

Example of <code>

<p>The first part of this sentence is normal text,<br>
<code>and the second is formatted with the &lt;code&gt; tag.</code></p>

Example result

The first part of this sentence is normal text,
and the second is formatted with the <code> tag.

Attributes

All HTML tags support standard attributes that define the settings of an HTML element. Unlike other HTML tags, the <code> tag has no unique attributes.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
All versions All versions All version All versions All versions

Additional phrase tags

Browser, Code, Compatibility, Container tag, Web design terms