Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to define subscripted text in HTML5?

  • Last Updated : 28 Oct, 2020

In this article, we define subscripted text in HTML by using the sub Element in the Document.This tag is used to add a subscript text to the HTML document. The <sub> tag defines the subscript text. Subscript text appears half a character below the normal line and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O to be written as H2O.

<sub> ----- content--- </sub>

Example 1:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

<!DOCTYPE html> 
    <h2>How to define subscripted Text</h2>
    <p>Testing <sub>subscript text</sub></p
    <p>Testing <sup>superscript text</sup></p


Example 2:

<!DOCTYPE html> 
        sub { 
            vertical-align: sub; 
            font-size: small; 
    <p>A sub element is displayed like this</p
    <p>This text contains <sub>subscript text</sub></p
    <p>Change the default CSS settings to see the effect.</p


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!