The <sup> tag is used to define superscript text in an HTML webpage while <sub> tag is used to define subscript text.
A subscript or superscript may a number, figure, fable(symbol), or indicator that is smaller than the stated parentage text (normal text).Subscripts appear under the baseline, even if superscripts are above.

Subscripts and superscripts are generally used in mathematical expressions and in languages.just like we want to add 3 power of 2 then we use supscript. <sub> tag for defining subscript text.

Superscript text can be used for footnotes, like Indianwebschool is india's leading web development learning portal[1].You can see it's example at wikipedia where it is used to show reference no.


You can understand use of <sup> and <sub> tags by a this example:-

e.g.

<!DOCTYPE html>
<html>
<head>
<title>sup tag< and <sub>/title>
</head>
<body>
<p>
This is superscripted<sup>text</sup> </p>

<p>
This is subscripted<sub>text</sub> </p>

</body>
</html>


Result:-

This is superscriptedtext

.

This is subscriptedtext

.


e.g.2

<!DOCTYPE html>
<html>
<head>
<title>sup tag< and <sub>/title>
</head>
<body>
<p>
2<sup>4</sup>=16
P<sup>x</sup>
</p>

</body>
</html>


Result:-

24 = 16
Px.



0 comments:

Post a Comment