HTML <sub> Tag

HTML <sub> tag is used to define subscript texts.Subscript text is under the baseline of other symbols of the line and has smaller font. The baseline passes through upper or lower edge of the symbols.

To define superscript text use <sup> tag.

Subscript text is often used for formulas.

Syntax

The content of the tag is between opening (<sub>) and 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>

Attributes

<sub> tag supports Global attributes.