HTML - <tt> Tag



Introduction to <tt> Tag

The HTML <tt> tag is used to specify teletype text. This element was created to render text as it would be displayed on a fixed-width display.

This tag is deprecated and no longer recommended for use in HTML5. Instead, you can use the <pre> or <kbd> tags.

Syntax

Following is the syntax of <tt> tag −

<tt> Content... </tt>

Attributes

The HTML <tt> tag supports Global and Event attributes.

Example: Define Teletype Text

Let's look at the following example, where we use the <tt> tag to define teletype text. This HTML code creates a webpage with a paragraph and teletype text, displaying "tutorialspoint".

<!DOCTYPE html> <html> <head> <title>HTML tt Tag</title> </head> <body> <p>tutorialspoint</p> <tt>learning website</tt> </body> </html>

Example: Teletype Text Alternative

In the following example we will create teletype text using <pre>, <kbd> and CSS properties. This HTML code creates a webpage with a paragraph and monoscope text, displaying "tutorialspoint".

<!DOCTYPE html> <html> <head> <title>HTML tt Tag</title> </head> <body> <p>tutorialspoint</p> <p style="font-family:'Lucida Console', monospace">This text is monospace text.</p> </body> </html>

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
tt Yes 1.0 Yes 12.0 Yes 1.0 Yes 4.0 Yes 15.0
html_deprecated_tags.htm
Advertisements