<tt>

The HTML <tt> element, which is now deprecated, was used to present text in a typewriter or monospace font. Today, the <code> element or CSS is recommended for achieving similar formatting.

tt tag

The <tt> tag in HTML, short for "teletype" or "typewriter text," was used to render text in a monospaced font. It has been deprecated in favor of using <code>, <pre>, or CSS properties like font-family: monospace.

Syntax

index.html
<tt>monospaced text</tt>

tt Demo

Enter the following at the telnet command prompt: set local echo
The telnet client should display: Local Echo is on

index.html
<p>
  Enter the following at the telnet command prompt: <code>set local echo</code>
  <br />
  The telnet client should display: <tt>Local Echo is on</tt>
</p>

Attributes

This element only supports global attributes, which are common to all HTML elements.

Conclusion

The <tt> tag, previously used to present monospaced text, is now obsolete. Modern replacements include <code> for inline code, <pre> for preformatted text, or CSS properties like font-family: monospace. These alternatives provide better semantic meaning and accessibility. It is recommended to avoid using <tt> and instead utilize these modern methods for displaying monospaced text.