Skip to: content, navigation

by Ian Lloyd

sub (HTML element)

Spec
Depr. Empty Version
No No HTML 2
Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full

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.

Figure 1. An example of sub Example of sub element

Use This For …

This element can be applied to any text content, but is likely to be limited to scientific or niche content.

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

The sub element enjoys good browser support.

Related Reading

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.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters