HTML <sub> tag

Updated: 10/11/2017 by Computer Hope

HTML sub tagWhen writing in HTML, the <sub> tag is an inline element used to designate subscript text, which appears lower, and usually smaller, than the text around it. It is useful for tasks like writing mathematical or chemical formulas. The following sections contain information about this tag, including an example of it in use, as well as related attributes and browser compatibility.

Tip: For superscript text, use the <sup> tag.

Example code

<p>This chemical formula for ammonia is NH<sub>3</sub>.</p>

Example result

This chemical formula for ammonia is NH3.

Attributes

Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair. While the <sub> tag does not have any unique attributes, it does utilize all of the standard attributes.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
All versions All versions All versions All versions All versions

Browser, Compatibility, Web design terms