CKTIS / HTML
sub — subscript
The sub element marks a meaning-bearing subscript, for example in a chemical formula or a variable identifier.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
<sub>text</sub>sub represents a subscript. Use it when text placement follows a meaningful convention, as in H₂O, rather than solely for decoration. In contrast, sup represents a superscript.
The element accepts phrasing content and is allowed wherever phrasing content is expected. Both tags are mandatory. It supports global attributes and has no element-specific attributes.
A variable's subscript can use sub inside var. For more detailed mathematical markup, the standard encourages MathML.
Examples
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Subscript example</title>
</head>
<body>
<p>H<sub>2</sub>O</p>
</body>
</html>Result
H₂O
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.