HTML Tags

HTML <tt> Tag

The <tt> tag in HTML stands for “teletype text.”
It was used to display text in a monospaced (fixed-width) font, resembling the output of old teletype machines.
This tag is deprecated in HTML5, and developers should use CSS or the <code> tag instead.

Syntax

<tt>Monospaced text</tt>

Attributes

AttributeDescription
NoneThe <tt> tag does not have any specific attributes.

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>TT Tag Example</title>
</head>
<body>

<h2>Deprecated &lt;tt&gt; Tag Example</h2>

<p>Normal text: Hello, World!</p>
<p>Teletype text using &lt;tt&gt;: <tt>Hello, World!</tt></p>

<p><strong>Modern alternative:</strong> Use CSS or &lt;code&gt; tag:</p>
<code style="font-family: monospace;">Hello, World!</code>

</body>
</html>

Output

Browser Output

The text inside the <tt> tag appears in a monospaced (typewriter-style) font.
Please use our TryIt Editor to see the effect.

Browser Support

Chrome
Chrome
Firefox
Firefox
Edge
Edge
Safari
Safari
Opera
Opera
IE
IE9+
✅Yes✅Yes✅Yes✅Yes✅Yes✅Yes

All major browsers support <tt> tag.

Notes

  • The <tt> tag is obsolete in HTML5.
  • Use CSS for styling monospaced text instead, for example:
p { font-family: monospace; }

The <code> tag is semantically appropriate for displaying computer code or command-line text.

Conclusion

The <tt> tag once displayed text in a fixed-width font but is now deprecated.
Use CSS or semantic tags like <code> for modern and standards-compliant web development.

Sign In Form

User your email and password to singn in

Don’t have an account, signup here : 

HTML5 & CSS3

Tools and Tutorials

Want a Website

Want a website for your business ?

Please fill out the details below, so we can reach out to you.

Registration Form

Signup to track your record and much more.

We have sent you an email with a registration link. Please click the link to verify your email address, or enter the 6-digit OTP provided in the email.

Didn't receive the OTP. Regenerate OTP Resend