VOOZH about

URL: https://www.geeksforgeeks.org/css/html-sub-tag/

⇱ HTML sub Tag - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML sub Tag

Last Updated : 3 Apr, 2026

The <sub> tag in HTML defines subscript text, displayed smaller and below the normal text baseline, commonly used in chemical formulas, mathematical expressions, and footnotes (e.g., H₂O or E=mc²).

Syntax:

<sub> Contents. . . </sub>

There are no such attributes that apply specifically to this <sub> tag. The attributes that only apply to this tag are global attributes.

Example 1: In this example, the <sub> tag is used to create subscript text. The "2" in the chemical formula "H₂O" is displayed as smaller and slightly lower than the baseline, indicating the number of hydrogen atoms.

Output:

👁 Image

Example 2: In this example the <sub> tag is used to display subscript text. It renders the "n" in the mathematical expression "xₙ + yₙ" smaller and below the baseline, indicating a variable's subscript.

Output:

👁 Image

Comment
Article Tags:
Article Tags: