Learning HTML 3.2 by Examples, section 5 Descriptions of HTML 3.2 tags:

SUP - superscript (Not in HTML 2.0!)

Purpose

To present superscripts. It its debatable whether this includes e.g. exponents in expressions.

Typical rendering

Slightly above the normal text level and possibly in smaller font. See general notes on rendering markup.

As a side effect, superscripts often cause lines to be unevenly spaced.

Basic syntax

<SUP>text</SUP>

Possible attributes

None.

Allowed context

Text container, i.e. any element that may contain text elements. This includes most HTML elements. In particular, text elements can be nested.

Contents

Text elements. Notice that this disallows e.g. paragraph breaks.

Examples

Note: Most of the examples here are mathematical. It is debatable whether such use reflects the intentions behind the HTML specification.

Example SUP-1.html:

The notation A<SUP>T</SUP> denotes the transpose of A.

Example SUP-2.html:

Consider the equation
x<SUP>n</SUP> + y<SUP>n</SUP> = z<SUP>n</SUP>.

Example SUP-3.html:

The expression a<SUP>b<SUP>c</SUP></SUP>
means a<SUP>(b<SUP>c</SUP>)</SUP>.

Example SUP-4.html:

This example is a text paragraph which contains several
superscripted expressions such as m<SUP>2</SUP> and e<SUP>x</SUP>.
They may affect the visual appearance of the paragraph by
forcing the browser to use different line heights. This
applies in particular to expressions with large and nested
superscripts such as (f(a))<SUP>e<SUP>x<SUP>2y</SUP></SUP></SUP>.

Example SUP-5.html:

Non-mathematical examples:<BR>
The word "first" can be written as 1<SUP>st</SUP>.<BR>
Foo<SUP>(TM)</SUP> is a trademark of Bar, Inc.<BR>
In French, the word "mademoiselle" is abbreviated M<SUP>lle</SUP>.

Notes

Digit 1, 2, or 3 as a superscript is representable in another way, too, since the ISO Latin 1 character set contains characters for them. Example: mē or, using character escape, m&sup2;.

There is also an element for subscripts, SUB, but HTML 3.2 provides no general support for mathematical formulas.

Since this element is new, support for it is not universal. Some browsers simply ignore it, displaying e.g. a<SUP>T</SUP> as aT. And naturally, text-only browsers cannot truly support SUP.

Superscripts can be nested, as the last example shows. This may, however, result e.g. in rendering inner superscripts in a very small font. Internet Explorer ignores SUP tags after nesting level of two.

See also general notes on text markup.



Date of last update: 2010-12-16.
This page belongs to the free information site IT and communication, section Web authoring and surfing, by Jukka "Yucca" Korpela.