Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 494945 of <tt>

  • Revision slug: Web/HTML/Element/tt
  • Revision title: <tt>
  • Revision id: 494945
  • Created:
  • Creator: kscarfone
  • Is current revision? Yes
  • Comment Updated tags

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 {{ HTMLElement("code") }} element.

This element is obsolete. Use a more appropriate element, such as {{ HTMLElement("code") }} or {{ HTMLElement("span") }} with CSS, instead.

Attributes

This element has no other attributes than the global attributes, common to all elements.

DOM Interface

This element implements the {{domxref('HTMLElement')}} interface.

Implementation note: up to Gecko 1.9.2 inclusive, Firefox implements the {{domxref('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

  • {{ HTMLElement("code") }}
  • HTML 4.01 Specification: Font Styles
{{ HTMLRef }}

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 {{ HTMLElement("code") }} element.</p>
<div class="note">
 This element is obsolete. Use a more appropriate element, such as {{ HTMLElement("code") }} or {{ HTMLElement("span") }} with <a href="/fr/docs/CSS" title="/fr/docs/CSS">CSS</a>, instead.</div>
<h2 id="Attributes">Attributes</h2>
<p>This element has no other attributes than the <a href="/en-US/docs/Web/HTML/global_attributes" title="HTML/global attributes">global attributes</a>, common to all elements.</p>
<h2 id="DOM_Interface">DOM Interface</h2>
<p>This element implements the {{domxref('HTMLElement')}} interface.</p>
<div class="note">
 <p><strong>Implementation note: </strong>up to Gecko 1.9.2 inclusive, Firefox implements the {{domxref('HTMLSpanElement')}} 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>{{ HTMLElement("code") }}</li>
 <li>HTML 4.01 Specification: <a class="external" href="https://www.w3.org/TR/html4/present/graphics.html#h-15.2">Font Styles</a></li>
</ul>
<div>
 {{ HTMLRef }}</div>
Revert to this revision