HTML <sub> / <sup> tags
- closing tag
- required
- void element
- no
- lives inside
- inline, inside running text
- typically holds
- a character or two
Where it goes
Around just the characters that go up or down, inside a line. Keep them short: a letter, a number, a symbol.
Example
<p>Water is H<sub>2</sub>O. The area of a square is x<sup>2</sup>.<sup><a href="#note1">1</a></sup></p>Open this example in the editor →
Common mistakes
- Using them to make text small. That is <small>, or CSS font-size. These also move the text up or down, which looks wrong on ordinary words.
- Wrapping a whole sentence in them. They are for a few characters inside a line.
- Letting them push the line taller. Browsers often add height around a <sup>. A line-height tweak in CSS fixes the jitter.