JavaScript EditorBest javascript editor debugger     Ajax website 

Main Page

Previous Page
Next Page

Creating Superscripts and Subscripts

Letters or numbers that are raised or lowered slightly relative to the main body text are called superscripts and subscripts, respectively. (X)HTML includes tags for defining both kinds of offset text.

To create superscripts or subscripts:

Type <sub> to create a subscript or <sup> to create a superscript.

Type the characters or symbols that you wish to offset relative to the main text.

Type </sub> or </sup>, depending on what you used in step 1, to complete the offset text.

Figure 4.15. The opening sup or sub tag precedes the text to be affected.


  • Most browsers automatically reduce the font size of a sub- or superscripted character by a few points.

  • Superscripts are the ideal way to format certain foreign language abbreviations like Mlle for Mademoiselle in French or 3a for Tercera in Spanish.

  • Subscripts are perfect for writing out chemical molecules like H20.

  • Superscripts are also handy for creating footnotes. You can combine superscripts and links to make active footnotes (the visitor jumps to the footnote when they click the number or asterisk). For more information, see Chapter 6, Links.

  • Super- and subscripted characters gently spoil the even spacing between lines (Figure 4.16). You can remedy this by changing the size of the sub or sup text (see pages 71 and 156) and adjusting its line height (see page 158).

Figure 4.16. Unfortunately, the sub and sup elements spoil the line spacing. Notice that there is more space between lines 6 and 7 of the first paragraph and lines 4 and 5 of the second than between the other lines.

Previous Page
Next Page

JavaScript EditorBest javascript editor debugger     Ajax website