Problem Statement
Which tags are used for subscript and superscript text?
Explanation
The sub tag creates subscript text, which appears below the normal line, while the sup tag creates superscript text, which appears above the normal line. Subscript is commonly used in chemical formulas, such as H2O for water. Superscript is used for mathematical exponents, such as X squared, or for footnote references. These tags are essential when displaying scientific or mathematical content. They have semantic meaning and help screen readers understand the content correctly. The browser automatically adjusts the position and size of subscript and superscript text. You can further style them with CSS if needed for specific design requirements.
Code Solution
SolutionRead Only
<!-- Subscript examples --> <p>Water formula: H<sub>2</sub>O</p> <p>Carbon dioxide: CO<sub>2</sub></p> <!-- Superscript examples --> <p>Einstein's equation: E=mc<sup>2</sup></p> <p>Area formula: A=πr<sup>2</sup></p> <p>Footnote reference<sup>1</sup></p>
