<p>The <strong class=html>CODE</strong> element denotes <em>computer code</em>. Visual browsers typically render <strong class=html>CODE</strong> as monospaced text, but authors can suggest a rendering using <a href="http://www.htmlhelp.com/reference/css/">style sheets</a>. Since <strong class=html>CODE</strong> is a structural element, it carries <em>meaning</em>, making it preferable to font style elements such as <strong class=html><a href="../fontstyle/tt.html">TT</a></strong> when marking up computer code.</p>
<p>Since spacing is often important when presenting computer code, the <strong class=html><a href="../block/pre.html">PRE</a></strong> element can be useful as a container for <strong class=html>CODE</strong> elements. When used within other containers, a <strong class=html>CODE</strong> element has multiple spaces collapsed. The following example uses <strong class=html>CODE</strong> within <strong class=html>PRE</strong>:</p>
<pre class=example><code class=html><PRE><CODE>
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
</CODE></PRE></code></pre>
<h2>More Information</h2>
<ul>
<li><a href="http://www.w3.org/TR/REC-html40/struct/text.html#edef-CODE">CODE in <abbr class=initialism title="World Wide Web Consortium">W3C</abbr> HTMLá4.0 Recommendation</a></li>
<li><a href="http://www.w3.org/TR/REC-html32#phrase">CODE in <abbr class=initialism title="World Wide Web Consortium">W3C</abbr> HTMLá3.2 Recommendation</a></li>
<li><a href="http://www.w3.org/MarkUp/html-spec/html-spec_5.html#SEC5.7.1.2">CODE in HTMLá2.0 Standard</a></li>
<li><a href="http://www.htmlhelp.com/reference/wilbur/phrase/code.html">CODE in <abbr class=initialism title="Web Design Group">WDG</abbr> HTMLá3.2 Reference</a></li>
<li><a href="http://www.hut.fi/u/jkorpela/HTML3.2/5.16.html">CODE in <cite>Learning HTMLá3.2 by Examples</cite></a></li>
</ul>
<div class=footer>
<address>Maintained by <a href="http://www.htmlhelp.com/%7Eliam/">Liam Quinn</a> <<a href="mailto:liam@htmlhelp.com">liam@htmlhelp.com</a>></address>