CLASS X SUB SCRIPT AND SUPER SCRIPT WITH EXAMPLE NOTES

 The <sup> (superscript) and <sub> (subscript) tags in HTML are used to format text that is displayed slightly above (superscript) or below (subscript) the normal text line. These tags are commonly used in mathematical expressions, chemical formulas, and footnotes.


1. Superscript (<sup>)

  • Description: Text wrapped in the <sup> tag is displayed slightly above the normal line of text.
  • Common Use: Exponents in mathematics, ordinal indicators (like 1st, 2nd), etc.

Example:


<p>This is an example of superscript: E = mc<sup>2</sup></p>

Output: This is an example of superscript: E = mc²

2. Subscript (<sub>)

  • Description: Text wrapped in the <sub> tag is displayed slightly below the normal line of text.
  • Common Use: Chemical formulas, mathematical variables with subscripts, etc.

Example:


<p>This is an example of subscript: H<sub>2</sub>O</p>

Output: This is an example of subscript: H₂O

Full HTML Example with Both Superscript and Subscript

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Superscript and Subscript Example</title>
</head>
<body>
<h1>Superscript and Subscript Examples</h1>
<p>This is an example of superscript: E = mc<sup>2</sup></p>
<p>This is an example of subscript: H<sub>2</sub>O</p>
</body>
</html>

Explanation:

  • The first <p> tag contains the formula "E = mc²" where the "2" is raised to a superscript using the <sup> tag.
  • The second <p> tag contains the chemical formula "H₂O" where the "2" is lowered to a subscript using the <sub> tag.


Post a Comment

0 Comments