HTML <tt> Tag Not Supported in HTML5

Topic: HTML5 Tags Reference« Prev|Next »

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.


Browser Compatibility

The <tt> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 2.1+

Further Reading

See tutorial on: HTML Text Formatting, CSS Fonts.

Related tags: <code>, <kbd>.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.