我們的志工尚未將本文翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
您也可以閱讀本文的 English (US) 版本。

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

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.

Attributes

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

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.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes Yes Yes1 Yes Yes Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
Basic support Yes Yes Yes Yes1 Yes Yes Yes

1. Before Firefox 4, this element implemented the HTMLSpanElement interface instead of the standard HTMLElement interface.

See also

文件標籤與貢獻者

 最近更新: teoli,