Skip to content

Latest commit

 

History

History
89 lines (53 loc) · 1.96 KB

File metadata and controls

89 lines (53 loc) · 1.96 KB

Episode 7: Superscript & Subscript Tags

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.


🧠 Learning Objectives

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

🔠 What Are Superscript and Subscript?

  • 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.


✍️ Syntax

<sup>Your Text Here</sup> <sub>Your Text Here</sub>

💡 Examples

🔢 Superscript Example:

<p>2<sup>3</sup> = 8</p>

Output: 2³ = 8


🧪 Subscript Example:

<p>Water formula is H<sub>2</sub>O</p>

Output: Water formula is H₂O


📚 Combining Both:

<p>X<sub>1</sub><sup>2</sup> + X<sub>2</sub><sup>2</sup> = Y</p>

Output: X₁² + X₂² = Y


🧠 Why Use Them?

  • Mathematics: Exponents and indices.
  • Science: Chemical and physics equations.
  • Documentation: Footnotes and citations (e.g., 1st, 2nd).

✅ Summary

  • <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.

🔗 Next Episode

➡️ 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. 🌐🔗