HTML <sub> tag

Updated: 08/02/2020 by Computer Hope
HTML sub tag

When writing in HTML (hypertext markup language), 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 and related attributes and browser compatibility.

Tip

For superscript text, use the <sup> tag.

Example of <sub> code

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

Example result

This chemical formula for ammonia is NH3.

Attributes

All HTML tags support standard attributes that define the settings of an HTML element. Unlike other HTML tags, the <sub> tag has no unique attributes.

Compatibility

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

Browser, Compatibility, Container tag, Web design terms