HTML5 <sub> Tag

The HTML <sub> tag is used to define a span of text that should be displayed, for typographic reasons, lower, and often smaller, than the main span of text.

The only content permitted inside this element is phrasing content. Both the starting and ending tag are mandatory for this element. The parent of the <sub> tag can be any element that can contain phrasing content.

This element should be used for typographical reasons only, i.e. changing the position of the text changing its meaning like in mathematical (like t2, though the use of a MathML formula should be considered) or chemical formulas (like H2O).

The following style is applied to this element by default:

sub {
  vertical-align: sub;
  font-size: smaller;

Here is an example of using this tag:

<p>The chemical formula of water: H<sub>2</sub>O</p>

f(<var>x</var>, <var>n</var>) = log<sub>4</sub><var>x</var><sup><var>n</var></sup>


This element only accepts global attributes.


See the Pen HTML sub Tag by Tutorialio (@tutorialio) on CodePen.

Further Reading

  1. Read more about the HTML <sub> element on MDN.
  2. You can also read the HTML <sub> tag reference on W3C.

Reader Comments

1. You can register or login to post a comment. Asking readers to register improves the quality of discussion.

2. As a registered user, you will also get to access features like choosing between a light and dark theme or anything else that we might implement in future.

Follow Us For Updates

Go To Top