# 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 = MC^{2}. 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 H_{2}SO_{4}. It is used in a similar way to the *superscript* element, and the example below shows this:

The chemical formula for Sulfuric Acid is H<sub>2</sub>SO<sub>4</sub>

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

http://webpageworkshop.co.uk/main/xhtml_sup

Last updated: 1st June, 2004