- Element of
- Learn How Fonts And Web Typography Work In HTML: A Beginner's Guide
- What does
<tt> HTML Tagdo?
- The <tt> element was used to identify text to be displayed using the browser's default monospace or fixed-width font as it would appear on a fixed-width device such as a teletype. This element has been deprecated and the <code> element is an appropriate modern replacement for <tt>.
<tt>Text as it would appear on a teletype.</tt>
What is a Teletype?
We don't use teletype printers anymore. However, several decades ago they were a common tool used to transmit information over a variety of communication media, including phone lines. As a matter of fact, teletype machines were even set up to interface with early computers – which is how we ended up with the
<tt> element. The element has been deprecated. Teletype printers have been out of use for long enough that very few people have any experience with them and there was virtually no ongoing proper use of the element. However, there are several other elements that produce a similar visual effect if your goal is to produce text in a monospace font.
What to use Instead of
If you're looking for an element that will identify text as being outside of the norm for some reason, you have a few different modern HTML elements to consider.
- pre: This is the right option if you want to preserve indentation and line breaks in plain text.
- code: This tag tells the browser that the identified text is computer programming code.
- kbd: If you want to identify keyboard input from a computer user, this is the appropriate choice.
- var: Variables in equations and computer programs can be identified with this tag.
- samp: Identifies text as being sample output from a computer program.
- CSS: Use CSS if you want to style text for purely stylistic purposes.