HTML sub Tag

HTML <sub> tag is known as the Subscript tag, employed to specify subscripted text. Text enclosed within <sub> displays at a lower baseline and in a smaller font compared to the surrounding text.

The <sub> tag is beneficial for displaying mathematical equations and chemical formulas like H 2 O.

Syntax

Example

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

Following are some details regarding the HTML <sub> element:

Display Inline
Start tag/End tag Both Start and End tag
Usage Textual

Example

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:

Attribute:

Tag-specific attributes:

The <sub> element does not have any particular attribute associated with it.

Global attribute:

The <sub> tag enables the utilization of Global attributes within HTML.

Event attribute:

The <sub> tag facilitates the utilization of Event attributes within HTML.

Supporting Browsers

Element Chrome IE Firefox Opera Safari
<sub> Yes Yes Yes Yes Yes

Input Required

This code uses input(). Please provide values below: