sub (HTML element)
Example
Here’s an example of the
sub element used for chemical formulas:
<p>That's not just water. That's not just H<sub>2</sub>O. That's
H<sub>2</sub>-woah!</p>
- Type
- inline element
- Contains
- inline elements only
- Contained by
- block-level elements, inline elements
Description
The sub
element is used to define subscript—text which appears half a character’s
height below the baseline of the line it’s on, and is most often used in
mathematical or chemical formulae.
The example HTML, where the number 2 is defined as subscript, would render on screen as shown in Figure 1.
sub
Use This For …
This element can be applied to any text content, but is likely to be limited to scientific or niche content.
Compatibility
| IE | 5.5 | Full |
|---|---|---|
| 6.0 | Full | |
| 7.0 | Full | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | Full |
| 2.0 | Full | |
| 3.0 | Full | |
| Opera | 9.2 | Full |
| 9.5 | Full |
The
sub element enjoys good browser
support.
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

