Loading...
Loading...
00:00:00

<sup> and <sub> tag in HTML5

The <sup> and <sub> tags in HTML5 are used to create superscript and subscript text, respectively. Superscript text is text that appears above the baseline of the surrounding text, and subscript text is text that appears below the baseline of the surrounding text.

sup tag

The <sup> tag is used to create superscript text, which is often used to represent exponents in mathematical equations or to specify footnotes in written documents. For example, if you want to write "x squared", you would use the following code:

x<sup>2</sup>

sub tag

The <sub> tag is used to create subscript text, which is often used in scientific and mathematical writing to represent subscripts, chemical formulas, or footnote references. For example, if you want to write "H<sub>2</sub>O", you would use the following code:

H<sub>2</sub>O

Both the <sup> and <sub> tags are inline elements, meaning that they only affect the text within the tag and do not create a separate block-level element. This allows you to include superscript and subscript text within normal text without disrupting the flow of the text.

It is also possible to nest superscript and subscript tags to create complex mathematical expressions. For example, if you want to write "x<sup>2</sup><sub>3</sub>", you would use the following code:

x<sup>2<sub>3</sub></sup>

The <sup> and <sub> tags in HTML5 are useful tools for creating superscript and subscript text. These tags are often used in mathematical and scientific writing to represent exponents, subscripts, chemical formulas, and footnotes. They are inline elements that do not create separate block-level elements, which allows you to include superscript and subscript text within normal text without disrupting the flow of the text. Additionally, it is possible to nest superscript and subscript tags to create complex mathematical expressions.