View video tutorial

HTML <code> Tag

HTML

The <code> element displays the text as a computer code.

HTML <code> Tag


The <code> tag is used to define a piece of computer or programming code.

The default monospace font family is used to display the content of <code> element.

Global attributes

Global attributes may be applied on all elements, although some elements may have no effect on them.

<accesskey>, <class>, <contenteditable>, <contextmenu>, <data-*>, <dir>, <draggable>, <dropzone>, <hidden>, <id>, <lang>, <spellcheck>, <style>, <tabindex>, <title>, <translate>.

Learning with HTML Editor "Try it Now"

You can edit the HTML code and view the result using online editor.

Example

<p><code>Computer code goes here</code>.</p>
<p>The <code>font-size</code> property defines the text font size of an element.</p>
Try it Now »

Click on the "Try it Now" button to see how it works.