Subscript <sub>text</sub> in HTML

Subscript is a text that appears just below the preceding text like TEXT1subscript. It is possible to do this in HTML using <sub> and </sub> tags which are known as subscript tag in HTML.

Table of contents:

  1. Using <sub> in HTML
  2. Using nested <sub> in HTML

Let us get started with subscript <sub> in HTML.

Using <sub> in HTML

For subscript in HTML:

  • The opening tag is <sub>
  • The closing tag is </sub>

The way to use this is as follows:

OPENGENUS<sub>2341</sub>

The output is as follows:

OPENGENUS2341

Using nested <sub> in HTML

We can use nested subscripts in HTML that is a subscript within a subscript. The inner subscript appears as a subscript to the previous subscript.

You can nest any number of subscripts in HTML.

Example of using nested <sub> in HTML:

A<sub>subscript1<sub>subscript2</sub></sub>

Output:

Asubscript1subscript2

The alternative of subscript is to put text at the top and it is done using superscript tag <sup> and </sup>. You can learn more about superscript in this article.

With this article at OpenGenus, you must have the complete idea of using subscript <sub> tag in HTML.