Webpage Workshop: Home » XHTML » Superscript and subscript

Superscript and subscript

Making text superscript or subscript can be useful when, for example, using chemical formulae or mathematical equations. They can also be useful in some foreign language scripts, such as French.

The superscript element is often used when writing mathematical equations, such as E = MC2. It is also used in some foreign language scripts. The example below illustrates how you use it:

Einstein's Special Theory of Relativity is E=MC<sup>2</sup>

The subscript element is useful when you have to represent a chemical formula, such as H2SO4. It is used in a similar way to the superscript element, and the example below shows this:

The chemical formula for Sulfuric Acid is

You may notice, that in the examples given, the superscript and subscript numbers were slightly smaller than the normal text. This effect was achieved using a stylesheet and is not normally associated with the elements alone, however the next tutorial will explain how this effect can be achieved using only XHTML.

<< Previous page | Next page >>