How to create teletype text in HTML?


In this article we are going to learn about how to create teletype text in HTML.

A teletype or typewriter-style monospace or fixed-width typeface is used to show the inline text created by the <tt> tag.

Monospace, monotype, and non-proportional all refer to the same thing. They both refer to a typeface whose characters are the same number of pixels wide and are used interchangeably.

Note − Not supported in HTML5

Syntax

Following is the syntax for teletype text.

<tt> Contents... </tt>

For getting better understanding on how to create teletype text in HTML

Example 1

In the following example we are using <tt> tag.

<!DOCTYPE html>
<html>
<body>
   <p>Welcome to TuttorialsPoint</p>
   <p><tt>The Best E-Way Learning.</tt></p>
</body>
</html>

When the script gets executed, it will generate an output consisting of two paragraphs: one is normal and the other was used with the <tt> tag on the webpage.

Example 2: Using CSS

Consider the following example we are using the CSS for teletype.

<!DOCTYPE html>
<html>
<body>
   <p>Welcome To Tutorials.</p>
   <p style="font-family: monospace">Where You Can Find A Lot Of Courses.</p>
</body>
</html>

On running the above script, the output window pops up, displaying the two texts. One is normal and the other was styled with monospace on the webpage.

Updated on: 15-Dec-2022

422 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements