The HTML tag sub is used to define subscript text. Subscript text appears smaller and lower than the normal text. It is commonly used in mathematical formulas, chemical formulas, and footnotes.
The sub tag is an inline element, which means it can be used within a paragraph or other inline elements. It has no required attributes.
Here are some examples of how to use the sub tag:
Example 1: The chemical formula for water is H2O.
Example 2: The Pythagorean theorem can be written as a2 + b2 = c2, where c is the hypotenuse of a right triangle.
Example 3: The footnote1 explains the meaning of the word.
Here is the code for the above examples:
Example 1: The chemical formula for water is H2O. <p>The chemical formula for water is H<sub>2</sub>O.</p>
Example 2: The Pythagorean theorem can be written as a2 + b2 = c2, where c is the hypotenuse of a right triangle. <p>The Pythagorean theorem can be written as a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup>, where c is the hypotenuse of a right triangle.</p>
Example 3: The footnote1 explains the meaning of the word. <p>The footnote<sub>1</sub> explains the meaning of the word.</p>
Overall, the sub tag is a useful tool for displaying subscript text in HTML documents.