what are the tags used to display a superscript and a subscript in a webpage. give each individual example for each
Answers
Answer :- The <sup> tag (which is short for “superscript”) displays the text as superscript, and the <sub> tag (which is short for “subscript”) displays the text as subscript. In order to create more complex formulas, such as, for example, x2 or xn+1, you can use the tags <sup> and <sub> one inside the other.
Example :-
<!DOCTYPE html>
<html>
<body>
<p>Testing <sub>subscript text</sub></p>
<p>Testing <sup>superscript text</sup></p>
</body>
</html>
Answer:
What is the use of <sub> and <sup> tag. Explain with suitable example.
Answer:-
The <sup> tag is used when we want to write anything in superscript.
For example,
If we want to write x raised to the power 3 i.e., \sf x^{3}x
3
then using <sup> tag, we can write this.
x<sup>3</sup>
Which gives output as,
\boxed{\large\sf {x}^{3}}
x
3
Similarly,
The <sub> tag is used when we want to write anything under subscript.
For example, if we want to write the formula of water(H2O) in website, then we can use <sub> tag to write "2" in subscript.
We can write as follows,
H<sub>2</sub>O
Which gives output as,
\boxed{\large\sf H_{2}O}
H
2
O
These tags require a closing tag and hence they are called container tags.