HTML Sub Tag

Sub Tag (Subscription)

At times, we are required to represent some content in our document in the subscript format. When we say subscript, it is slightly below the normal font. For example, if we are required to represent the formula of water, which is H2O, where 2 is in the subscript as you can see, it is possible for us to do so, in our document.

We just have to use the subtag, which simply is used for the subscript thing. Here is an example –

Subscript Example

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Subscript example</title>
</head>
<body>
<p>The formula for water : H<sub>2</sub>O</p>
</body>
</html>

If we have a look at the output, it looks something like this –

As you can see, the 2 is in the subscript as required. For getting something into subscript, we just have to write that something between <sub> and </sub>. So, whenever we are required to have something into subscript, we can make use of the subtag. You can try solving more examples, and more use cases.