HTML<sub> tag

HTML <sub> tag is termed as Subscript tag and which is used to define subscript text. The text within <sub> renders with a lower baseline and with a smaller font than surrounding text font.

The <sub> tag is useful for presenting mathematical formula and chemical formulas such as H2O.

Syntax

<sub>.........</sub>

Following are some specifications about the HTML <sub> tag

DisplayInline
Start tag/End tagBoth Start and End tag
UsageTextual

Example

<!DOCTYPE html>  

<html>  

<head>  

     <title>Sub Tag</title>  

    <style>  

     body{  

         text-align: center;  

     }  

     p{  

      color: green;  

     }  

    </style>  

</head>  

<body>  

<h2>Example of sub tag</h2>  

<p>The chemical formula for Sulphuric acid is: H<sub>2</sub>SO<sub>4</sub></p>  

</body>  

</html>

Output:

HTML sub tag

Attribute:

Tag-specific attributes:

The <sub> tag does not contain any specific attribute.

Global attribute:

The <sub> tag supports the Global attributes in HTML.

Event attribute:

The <sub> tag supports the Event attributes in HTML.

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
<sub>YesYesYesYesYes

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *