Superscripts and Subscripts

Superscripts are sections of your text that have been raised up so that they are higher than the other content of the line while subscripts are sections of text that have been lowered so that they drop below the rest of the line content. The most obvious use of superscripts and subscripts is in writing formulae of various types such as x2 or H2O or to indicate footnote references (where you might also makke the subscript a link to the point lower on the page where the footnote appears).

The way that we identify that text which is to be moved up or down relative to the rest of the line is by using the <sup></sup> and <sub></sub> containers respectively to contain the content that is to be moved.

As with all of the other tags that you use in your HTML the purpose of placing these tags around a piece of content is to identify which part of the line is to be moved. The actual appearance of this content on the page will be handled by the sstylesheet and so using the tags by themselves without then styling their content may not give you exactly the appearance that you require. In most cases you will want the superscript or subscript text to be smaller than the surrounding text as well as being moved up or down relative to the surrounding text. With the examples that I gave above I used stylesheet commands to reduce the size of the superscript and subscript text to 70% of the size of the surrounding text in addition to having identified it with the appropriate tags.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow