mozilla

Revision 17449 of <code>

  • Revision slug: HTML/Element/code
  • Revision title: code
  • Revision id: 17449
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 31 words added, 8 words removed

Revision Content

The HTML Code Element (<code>) produces an inline element displayed in the browser's default monotype font (Lucida Console). This element was intended to identify a fragment of computer code, but commonly is used to style any text in a fixed width font.

DOM Interface

This element implements the HTMLElement interface.

Implementation note: up to Gecko 1.9.2 included, Firefox implements the HTMLSpanElement interface for this element.

Example

   Regular text. <code>This is code.</code> Regular text.

Result

Regular text. This is code. Regular text.

Note

A CSS rule can be defined for the code selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS.

See also

{{ HTML:Element_Navigation() }}

{{ languages( { "pl": "pl/HTML/Element/code" } ) }}

Revision Source

<p>The HTML Code Element (<span style="font-family: Courier New;">&lt;code&gt;</span>) produces an inline element displayed in the browser's default monotype font (Lucida Console). This element was intended to identify a fragment of computer code, but commonly is used to style any text in a fixed width font.</p>
<h3 class="editable">DOM Interface</h3>
<p>This element implements the <code><a href="/en/DOM/element" title="en/DOM/element">HTMLElement</a></code> interface.</p>
<div class="note">
<p><strong>Implementation note: </strong>up to Gecko 1.9.2 included, Firefox implements the <a href="/en/DOM/span" title="en/DOM/span"><span style="font-family: Courier New;">HTMLSpanElement</span></a> interface for this element.</p>
</div>
<h3 name="Example">Example</h3>
<pre class="eval">   Regular text. &lt;code&gt;This is code.&lt;/code&gt; Regular text.
</pre>
<h4 name="Result">Result</h4>
<p>Regular text. <code>This is code.</code> Regular text.</p>
<h3 name="Note">Note</h3>
<p>A CSS rule can be defined for the <code>code</code> selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS.</p>
<h3 name="See_also">See also</h3>
<ul> <li><a href="/en/HTML/Element/blockquote" title="en/HTML/Element/blockquote">HTML Block Quotation Element</a></li> <li>HTML 4.01 Specification: <a class="external" href="http://www.w3.org/TR/html4/struct/text.html#h-9.2.1">Phrase Elements</a></li>
</ul>
<p>{{ HTML:Element_Navigation() }}</p>
<p>{{ languages( { "pl": "pl/HTML/Element/code" } ) }}</p>
Revert to this revision