• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 4. Basic (X)HTML Formatting > Creating Superscripts and Subscripts

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.18. The opening sup or sub tag precedes the text to be affected.


<h1>Famous Catalans</h1>

<p>When I was in the sixth grade, I played the
cello. There was a teacher at school who always
used to ask me if I knew who "Pablo Casals" was. I
didn't at the time (although I had met Rostropovich
once at a concert). Actually, Pablo Casals' real
name was <i>Pau</i> Casals, Pau being the
Catalan equivalent of Pablo<sup>1</sup>.</p>

<p>In addition to being an amazing cellist, Pau
Casals is remembered in this country for his
empassioned speech against nuclear proliferation
at the United Nations<sup>2</sup> which he
began by saying "I am a Catalan. Catalonia is an
oppressed nation."</p>

<p><sup>1</sup>It means Paul in English.<br />

<sup>2</sup>In 1963, I believe.</p>


Figure 4.19. Unfortunately, the sub and sup elements spoil the line spacing. Notice that there is more space between lines 3 and 4 of the first paragraph and lines 1 and 2 of the second than between the other lines.

Figure 4.20. You can use styles to adjust the size and leading so that the lines are properly spaced.


  • 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 H2O.

  • 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 7, Links.

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

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint