HTML Subscript and Superscript is used to give formatting to the text on the web page.
sub tag makes text smaller and moves downward from the normal position which shows that the text is subscript text.
sup tag makes text smaller and moves upward from the normal position which shows that the text is superscript text.
HTML Subscript is defined by <sub> tag.
HTML Superscript is defined by <sup> tag.
In the above, we have shown an example of HTML Subscript.
<sub> tag moves the text slightly downward which is used to show chemical formulae on the web page.
Run the code to see the effect.
In the above, we have shown an example of HTML Superscript.
<sup> tag moves the text slightly upward which is used to show mathematical formulae on the web page.
Run the code to see the effect.
HTML Superscript is used to write Mathematical Formulas.
HTML Subscript is used to write Chemistry Formulas.