Text Content

HTML <sub> element

Marks typographic subscripts where the lowered position carries meaning, such as chemical formulas. Use sub where lowered position represents meaningful notation, such as the 2 in H2O. For layout positioning use CSS; for complex mathematics consider appropriate mathematical markup. It accepts global HTML attributes; individual global features may be inapplicable or restricted.

Formal Syntax & Structure

html syntaxhtml
<sub>Subscript</sub>

Return Value

HTMLElement

Content model: Phrasing content, with element-specific restrictions.

Working Example

Example Snippethtml
<!doctype html><html lang="en">  <head>    <meta charset="utf-8">    <title>HTML example</title>  </head>  <body>    <p>      H      <sub>2</sub>      O    </p>  </body></html>
HTML Reference