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

SUB - subscript (Not in HTML 2.0!)

Purpose

To present subscripts, which are typically indexes attached to variables.

Typical rendering

Slightly below the normal text level, often so that it the text is vertically centered with respect to normal text baseline, and possibly in smaller font. See general notes on rendering markup.

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

Basic syntax

<SUB>text</SUB>

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

Mathematical usage:

Example SUB-1.html:

Let us form the sum of all x<SUB>i</SUB>'s, ie
x<SUB>1</SUB> + x<SUB>2</SUB> + ... + x<SUB>n</SUB>.

Usage in chemistry:

Example SUB-2.html:

SO<sub>3</sub> + H<sub>2</sub>O -> H<sub>2</sub>SO<sub>4</sub>

Using SUB and SUP to affect the presentation of fractions:

Example SUB-3.html:

Fractions &frac12; and  &frac14; and &frac34; have their own
symbols in ISO Latin 1. Other fractions like <SUP>2</SUP>/<SUB>3</SUB>
must be essentially presented in linearized notation, although you
can use SUB and SUP to affect the presentation.

Notes

There is also an element for superscripts, SUP, 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<SUB>1</SUB> as a1. And naturally, text-only browsers cannot truly support SUB.

Subscripts can be nested. This may, however, result e.g. in rendering inner superscripts in a very small font. Internet Explorer ignores SUB 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.