Description

The <tt> (short for teletype text) tag renders the text it encloses in a teletype or monospaced typeface without conveying any extra importance. The <tt> tag is much like the <b> and <i> tags, it doesn't convey any semantic information about the text it encloses – it is purely used for text formatting purposes.

The following table summarizes the usages context and the version history of this tag.

Placement:Inline
Content:Inline and text
Start/ End Tag:Start tag: required, End tag: required
Version:HTML 2, 3.2, 4, 4.01

Warning: Do not use this tag, as it has been obsolete since HTML5. Use a more appropriate tag, such as <code> or <span> with CSS font's properties, instead.

Syntax

The basic syntax of the <tt> tag is given with:

HTML/XHTML: <tt> ... </tt>

The example below shows the <tt> tag in action.

<!--Example of bad usage. Don't use this tag-->
<p>This is a <tt>sample code</tt>.</p>
<!--Alternative-->
<p>This is a <code>sample code</code>.</p>

Tag-Specific Attributes

The <tt> tag doesn't have any specific attribute.

Global Attributes

Like all other HTML tags, the <tt> tag ttports the glodelal Attributes in HTML5.

Event Attributes

The <tt> tag also ttports the event Attributes in HTML5.

Browser Compatibility

Element
<tt>YesYesYesYesYes