Advertisement
❮ Previous: <cite> Next: <col> ❯

<code>

HTML <code> (Code) Tag

Example

<p> The <code>&lt;center&gt;</code> tag is deprecated by HTML5 version.</p>

Try this code ❯

Meaning

The <code> element indicates that the enclosed text is source code in a programming language.

Note: This element is best used for short code fragments because it does not preserve white space.

Related Elements

Tag Description
<kbd> keyboard input
<pre> preformatted text
<samp> sample output
<var> variable

Version: HTML 2, 3.2, 4, 4.01,5


Standard Syntax

<code>Code</code>


Advertisement

Global Attributes

<code> element also supports the Global Attributes in HTML.


Event Attributes

<code> element also supports the Event Attributes in HTML.


By Default CSS Value(s)

Most of the browsers will display the <code> element with the following by default value(s)

code {
  font-family: monospace;
}

Related Tags:

<a>,
<abbr>,
<b>,
<bdi>,
<bdo>,
<br>,
<cite>,
<data>,
<dfn>,
<em>,
<i>,
<kbd>,
<mark>,
<q>,
<rp>,
<rt>,
<ruby>,
<s>,
<samp>,
<small>,
<span>,
<strong>,
<sub>,
<sup>,
<time>,
<u>,
<var> and
<wbr>

❮ Previous: <cite> Next: <col> ❯
Advertisement