Computer Study

sub Tag in HTML

The <sub> tag is an HTML tag used to represent subscripted text. Subscripted text is text that is written in a smaller font size and is located below the normal line of text. This tag is used to indicate a small number, letter, or symbol that is placed below the main text.

To use the <sub> tag, you can follow these simple steps:

Step 1: Open a new HTML file in a text editor.

Step 2: Create the text that you want to display as subscripted text.

Step 3: Wrap the text that you want to display as subscripted text in the <sub> tag.

Step 4: Save the HTML file with an appropriate name and extension.

Here is an example of how to use the <sub> tag in HTML:

<!DOCTYPE html>
<html>
<head>
<title>Subscript Example</title>
</head>
<body>
<h1>Using Subscripted Text</h1>
<p>The chemical formula for water is H<sub>2</sub>O.</p>
</body>
</html>

In the above example, the <sub> tag is used to subscript the number “2” in the chemical formula for water. When the HTML file is opened in a web browser, the number “2” will be displayed in a smaller font size and located below the “H” and “O” characters.

It is important to note that the <sub> tag should only be used for subscripted text, and not for any other type of formatting or styling. It is also recommended to use the <sup> tag for superscripted text, which is text that is written in a smaller font size and located above the normal line of text.

In conclusion, the <sub> tag is a simple and useful HTML tag that can be used to display subscripted text. By following the above steps, you can easily incorporate the <sub> tag into your HTML code and enhance the readability and appearance of your text.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Close
Back to top button