**`<tt>`** (short for 'teletype', referencing old fixed-width terminal printers) rendered text in a monospace font with no other semantic meaning. It was removed in HTML5 in favor of more specific, semantically meaningful elements: `<code>` for code snippets, `<kbd>` for keyboard input, `<samp>` for program output, or plain CSS `font-family: monospace` when none of those specific meanings apply.
1Understanding <tt>
`<tt>` (short for 'teletype', referencing old fixed-width terminal printers) rendered text in a monospace font with no other semantic meaning. It was removed in HTML5 in favor of more specific, semantically meaningful elements: <code> for code snippets, <kbd> for keyboard input, <samp> for program output, or plain CSS font-family: monospace when none of those specific meanings apply.
If you just want a monospace visual style with no code-related meaning, use CSS font-family: monospace on a <span> rather than reaching for a deprecated tag.
<!-- Old, deprecated markup -->
<p>Type <tt>cd my-project</tt> to enter the folder.</p>2Practical Example
Here is a real-world application of <tt> showing how it is used in production HTML.
<!-- Correct modern replacement -->
<p>Type <code>cd my-project</code> to enter the folder.</p>3Best Practices
Follow these guidelines when working with <tt>:
1. Don't use <tt> in new code — use <code>, <kbd>, or <samp> depending on the actual meaning
2. Use CSS font-family: monospace for purely visual fixed-width styling
3. Migrate legacy <tt> usage to the semantically correct modern element
Tip: If you just want a monospace visual style with no code-related meaning, use CSS font-family: monospace on a <span> rather than reaching for a deprecated tag.
<!-- Old, deprecated markup -->
<p>Type <tt>cd my-project</tt> to enter the folder.</p>