Subscripts and superscripts: the SUB and SUP elements

The <sub> tag is defined to write a subscript or dropped text and the <sup> tag is defined to write a superscript or raised text. Both tags can be useful especially if you want to show some math formulas.

Mathmatical Example

Math Example with superscript

x a x b = x (a + b)

The html;
<p>x<sup> a</sup> x<sup> b</sup> = x<sup> (a + b)</sup></p>

Math Example with subscript

The area of a trapezoid=h/2 (b1 + b2)

The html;
<p>The area of a trapezoid=h/2 (b<sub>1</sub> + b<sub>2</sub>)</p>

Text Examples.

Example of superscript

<p>Here is some <sup>superscripted</sup> text.</p>

Here is some superscripted text.

Example of subscript

<p>Here is some <sub>subscripted</sub> text.</p>

Here is some subscripted text.

The scripts are also handy for properly displaying a copyright or trademark symbol.

Company name© Company name