You are here: >

HTML <code> tag

HTML code tagWhen writing in HTML, the <code> tag is an inline 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, as well as 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 code

<p>This is a regular sentence that has <code>a bit of code</code>
   contained within it.</p>

Example result

This is a regular sentence that has a bit of code contained within it.


Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair. While the <code> tag does not have any unique attributes, it does utilize all of the standard attributes.


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

Additional phrase tags

Also see: Browser, Code, Compatibility