HTML <sub> Tag

The <sub> tag is used to define the subscript text that appears half a character below the line, and is rendered in a smaller font. Subscript text is often used for defining chemical formulas.

To define superscript text, use the <sup> tag.

Syntax

The content of the tag is between the opening (<sub>) and the closing (</sub>) tags.

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>Formula of water - H<sub>2</sub>O,  formula of alcohol - C<sub>2</sub>H<sub>5</sub>ОН</p>
  </body>
</html>

Result

Attributes

The <sub> tag supports the Global attributes and the Event Attributes.

Browser support





Related articles