The <tt> tag in HTML stands for teletype text. It was used in HTML 4 to define text in a monospaced, teletype-style font. However, the tag has been deprecated in HTML5 because it only served a presentational purpose without adding any semantic meaning to the content.
Instead of using <tt> tag, achieve the same result by using CSS to apply a monospaced font to the text. The font-family property is used to set a monospaced font, such as Courier, Courier New, or monospace
<!DOCTYPE html>
<html>
<body>
<tt>
GfG stands for GeeksforGeeks
</tt>
<p>
<tt>
It is a computer science
portal for geeks
</tt>
</p>
</body>
</html>
Syntax
<tt> Content will displayed in a monospaced font</tt>Instead of using the <tt> tag, HTML5 provides semantic elements like:
- <kbd>: Represents user input, like keyboard strokes.
- <var>: Represents a variable in programming or math.
- <code>: Represents a fragment of computer code.
- <samp>: Represents sample output from a program or system.