liveBook · Manning

Sub element

As explained in Web Design Playground, Second Edition

The HTML sub element marks text as a subscript positioned partially below the text baseline.

The HTML <sub> element marks text as a subscript: a smaller piece of text positioned partly below the normal text baseline. It is especially handy for chemical and mathematical formulas. section 16.1

A chemical formula

Wrap the formula’s lower numbers in <sub> tags: FeSO<sub>4</sub> and C<sub>7</sub>H<sub>6</sub>O<sub>5</sub>. The browser places those numbers below the baseline. section 16.1

Many illuminated manuscripts are written using iron gall ink, which is iron sulfate (FeSO<sub>4</sub>) added to gallic acid (C<sub>7</sub>H<sub>6</sub>O<sub>5</sub>).

See the complete chemical-formula example using several subscripted numbers. section 16.1

Use <sub> when the lowered position carries meaning, not merely because smaller text looks decorative. section 16.1

How Web Design Playground, Second Edition covers it

How deep it goes
Defines the element, describes its browser rendering, and demonstrates it in a chemical formula.
Examples
Demonstrates iron sulfate and gallic acid formulas with subscripted numbers.
What it assumes
Assumes basic HTML element markup and introduces the subscript concept through visible browser formatting.
What you can do after
Build it from scratch by marking formula characters with HTML <sub> tags.
How it connects
Connects chemical formulas and mathematical formulas with HTML text-level elements.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground, Second Edition. The section links point to the parts of the book it draws on.