English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
HTML telegraph text element ( <tt>) generates an inline element, displaying text with the browser's built-in monotype font. This element is used for text formatting, making it display in a fixed-width, similar to telegrams. Using the <code> element to display fixed-width text may be more common.
Demonstration of using tt:
!doctype html> <html> <head> <meta charset="UTF-8"> <title>HTML tt tag usage (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> <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> </body> </html>Test to see ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the <tt> tag.
HTML5 Does not support <tt> t tag. Use CSS instead.
The <tt> tag defines typewriter text.
Tip:Use CSS to specify the text type in the document.
CSS specifications can define tt selectors to override the default browser font. Preferences set using CSS may take precedence over specified CSS.
Although this element is not in the HTML 4.01 Abandoned in the HTML specification, not recommended for use to support style sheets.
HTML5 Does not support <tt> tag. HTML 4.01 Supports <tt> tag.
In HTML 4.01 The <tt> tag supports the following standard attributes:
Attribute | Value | Description |
---|---|---|
class | classname | Class name of the specified element |
dir | rtl ltr | Text direction within the specified element |
id | id | Unique id of the specified element |
lang | language_code | Language code for the content of the specified element |
style | style_definition | Specify the inline style of an element |
title | text | Specify additional information about an element |
xml:lang | language_code | Specify the language code for the content of an XHTML document element |
For a complete description, please visitStandard Attributes.
In HTML 4.01 In, the <tt> tag supports the following event attributes:
Attribute | Value | Description |
---|---|---|
onclick | script | Execute script when the mouse is clicked |
ondblclick | script | Execute script when the mouse is double-clicked |
onmousedown | script | Execute script when the mouse button is pressed |
onmousemove | script | Execute script when the mouse pointer moves |
onmouseout | script | Execute script when the mouse pointer moves out of an element |
onmouseover | script | Execute script when the mouse pointer hovers over an element |
onmouseup | script | Execute script when the mouse button is released |
onkeydown | script | Execute script when the keyboard is pressed |
onkeypress | script | Execute script when the keyboard is pressed and then released |
onkeyup | script | Execute script when the keyboard is released |
For a complete description, please visitEvent Attributes.