HTML » Tags » code

Version: 2.0, 3.2, 4.0

Compability: Explorer 4, 5  Netscape 4, 6

<code> ... </code>

The <code> tag is designed to display computer code in a special font, usually in a mono spaced font style. However, the exact appearance will be browser dependent. You may still need to use various HTML tags, such as br and p, to create a presentation and appearance to suit your needs.

An HTML code example cannot use the HTML delimiters < and >, because they will be executed by the browser as real HTML code. Rather you must substitute a &lt; for the < and a &gt; for the >.
Usually, the display font appearance for the code, kbd, samp, and tt tags is the same. The listing tag has been deprecated.
The pre tag is more commonly used to display code.
The closing tag is mandatory.


if (document.getElementById) blnDOM = true;<br>
else if (document.layers) blnNN4 = true;<br>
else if (document.all) blnIE4 = true;<br>
if (document.getElementById) blnDOM = true;
else if (document.layers) blnNN4 = true;
else if (document.all) blnIE4 = true;
Language(s): HTML

See Also: