Subscript
The <sub> tag is used to add a subscript text to the HTML document. The <sub> tag defines the subscript text. Subscript text appears half a character below the normal line and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O to be written as H2O.
Example:
In this example, we are using the <sub> tag that is used for subscript:<p>Testing <sub>subscript text</sub></p>
Testing subscript text
Superscript
The <sup> tag is used to add superscript text to the HTML document. The <sup> tag defines the superscript text. Superscript text appears half a character above the normal line and is sometimes rendered in a smaller font. Superscript text can be used for footnotes.
Example:
In this example, we are using the <sub> tag that is used for Superscript:<p>Testing <sup>superscript text</sup></p>
Testing Superscript text