English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Comprehensive List

HTML: <sub> tag

HTML <sub> tag defines subscript text in an HTML document. For example, in the chemical formula CO 2In the context of numbers2The subscript is represented in a smaller font and appears lower on the baseline. This tag is also commonly referred to as the <sub> element.

Online Example

Chemical molecular formula subscript demonstration:

!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML sub Tag Usage (Basic Tutorial Website oldtoolbag.com)</title>
</head>
<body>
   <h1>Demonstration of subscript in chemical molecular formula</h1>
<p>The chemical formula for ammonia is NH<sub>3</sub>.</p>
</body
</html>
Test and see ‹/›

In this HTML5In the document example, we use the <sub> tag to define NH 3Chemical formula.3Rendered as smaller text, half the height of other text.

Browser compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support the <sub> tag.

tag definition and usage instructions

tag defines subscript text. Subscript text will be displayed below the baseline of the current text flow at half the height of the current text flow characters, but it will have the same font and size as the current text flow. Subscript text can be used to represent chemical formulas, such as H2O.

Tip: Please use <sup> tag defines superscript text.

HTML 4.01 and HTML5Differences between

None.

Global attributes

Support for <sub> tag Global attributes of HTML.

Event attributes

Support for <sub> tag HTML event attributes.