mozilla

Revision 308187 of <tt>

  • Revision slug: HTML/Element/tt
  • Revision title: tt
  • Revision id: 308187
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment

Revision Content

{{ obsolete_header() }}

Summary

The HTML Teletype Text Element (<tt>) produces an inline element displayed in the browser's default monotype font. This element was intended to style text as it would display on a fixed width display, such as a teletype. It probably is more common to display fixed width type using the <code> element.

This element is obsolete. Use a more appropriate element, such as code or span with CSS, instead.

DOM Interface

This element implements the HTMLElement interface.

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

Example

<p>Enter the following at the telnet command prompt: <code>set localecho</code><br />

The telnet client should display: <tt>Local Echo is on</tt></p>

Result

Enter the following at the telnet command prompt: set localecho
The telnet client should display: Local Echo is on

Notes

  • A CSS rule can be defined for the tt selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS.
  • Although this element was not deprecated in the HTML 4.01 specification, its use is discouraged in favor of style sheets.

See also

{{ HTML:Element_Navigation() }}

Revision Source

<div>{{ obsolete_header() }}</div>
<h2 id="Summary">Summary</h2>
<p>The HTML Teletype Text Element (<code>&lt;tt&gt;</code>) produces an inline element displayed in the browser's default monotype font. This element was intended to style text as it would display on a fixed width display, such as a teletype. It probably is more common to display fixed width type using the <code>&lt;code&gt;</code> element.</p>

<div class="note">This element is obsolete. Use a more appropriate element, such as <code>code</code> or <code>span</code> with CSS, instead.</div>


<h2 id="DOM.C2.A0Interface">DOM Interface</h2>
<p>This element implements the <code><a href="/en-US/docs/DOM/element" title="DOM/element">HTMLElement</a></code> interface.</p>
<div class="note">
  <p><strong>Implementation note: </strong>up to Gecko 1.9.2 inclusive, Firefox implements the <a href="/en-US/docs/DOM/span" title="DOM/span"><code>HTMLSpanElement</code></a> interface for this element.</p>
</div>
<h2 id="Example">Example</h2>

<pre class="brush:html">&lt;p&gt;Enter the following at the telnet command prompt: &lt;code&gt;set localecho&lt;/code&gt;&lt;br /&gt;

The telnet client should display: &lt;tt&gt;Local Echo is on&lt;/tt&gt;&lt;/p&gt;
</pre>

<h3 id="Result">Result</h3>
<p>Enter the following at the telnet command prompt: <code>set localecho</code><br />
The telnet client should display: <code>Local Echo is on</code></p>

<h2 id="Notes" name="Notes">Notes</h2>
<ul>
  <li>A CSS rule can be defined for the <code>tt</code> selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS.</li>
  <li>Although this element was not deprecated in the HTML 4.01 specification, its use is discouraged in favor of style sheets.</li>
</ul>

<h2 id="See_also" name="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/HTML/Element/code" title="HTML/Element/code">HTML Code Element</a></li>
  <li>HTML 4.01 Specification: <a class="external" href="http://www.w3.org/TR/html4/present/graphics.html#h-15.2">Font Styles</a></li>
</ul>

<div>{{ HTML:Element_Navigation() }}</div>
Revert to this revision