Welcome to Episode 7 of the Learn HTML series! In this episode, we’ll explore the use of superscript and subscript tags in HTML — perfect for writing scientific notations, mathematical expressions, chemical formulas, and footnotes.
By the end of this episode, you will:
- Understand the use of
<sup>and<sub>tags - Learn how to display superscript and subscript content
- Know practical use-cases where these tags are helpful
-
Superscript (
<sup>): Displays text above the normal line of text.
→ Used for exponents, ordinal indicators (like 1st), etc. -
Subscript (
<sub>): Displays text below the normal line of text.
→ Commonly used in chemical formulas like H₂O.
<sup>Your Text Here</sup> <sub>Your Text Here</sub><p>2<sup>3</sup> = 8</p>Output: 2³ = 8
<p>Water formula is H<sub>2</sub>O</p>Output: Water formula is H₂O
<p>X<sub>1</sub><sup>2</sup> + X<sub>2</sub><sup>2</sup> = Y</p>Output: X₁² + X₂² = Y
- Mathematics: Exponents and indices.
- Science: Chemical and physics equations.
- Documentation: Footnotes and citations (e.g., 1st, 2nd).
<sup>raises content — ideal for exponents and ordinal indicators.<sub>lowers content — great for subscripts in formulas.- Both help in presenting information with correct formatting and context.
➡️ Episode 8: Anchor Tags and target Attribute
Awesome! Next, we'll learn about anchor tags and how to use the target attribute to open links in new tabs or windows. 🌐🔗