Advertisement

Responsive Advertisement

Subscript and Superscript in HTML

Understanding Subscript and Superscript in HTML

Subscript and Superscript

  1. Superscript

    Superscript is used for small text or numbers placed higher than the normal text baseline. It's commonly used in mathematical expressions, exponents, and footnotes.

    Examples of Superscript Usage:

    • Mathematical Expressions (e.g., x2, p5)
    • Footnote References (e.g., 1, 2, 3)
    • Exponents (e.g., 42, 52)

    HTML CODE:

    <html>
    <head>
    <title>Superscript</title>
    </head>
    <body>
    <p>Water Formula: a<sup>2</sup>b<sup>2</sup></p>
    </body>
    </html>

    OUTPUT:

    a2b2
  2. Subscript

    Subscript is used for small text or numbers placed below the normal text baseline, commonly used in chemical formulas, footnotes, and exponents.

    Examples of Subscript Usage:

    • Mathematical Expressions (e.g., x2, p5)
    • Footnote References (e.g., 1, 2, 3)
    • Exponents (e.g., 42, 52)

    HTML CODE:

    <html>
    <head>
    <title>Subscript</title>
    </head>
    <body>
    <p>Water Formula: H<sub>2</sub>O</p>
    </body>
    </html>

    OUTPUT:

    H2O

Post a Comment

0 Comments