The
<sub>
element should be used only for typographical reasons?that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes.
For example, using
<sub>
to style the name of a company which uses altered baselines in their
wordmark
would not be appropriate; instead, CSS should be used. For example, you could use the
vertical-align
property with a declaration like
vertical-align: sub
or, to more precisely control the baseline shift,
vertical-align: -25%
.
Appropriate use cases for
<sub>
include (but aren't necessarily limited to):
- Marking up footnote numbers. See
Footnote numbers
for an example.
- Marking up the subscript in mathematical variable numbers (although you may also consider using a
MathML
formula for this). See
Variable subscripts
.
-
Denoting the number of atoms of a given element within a chemical formula (such as every developer's best friend, C
8
H
10
N
4
O
2
, otherwise known as "caffeine"). See
Chemical formulas
.