HTML

HTML – SUB (Subscript) and SUP (Superscript) Tags

HTML <sub> Tag

The tag <sub> is defined as Subscript.   It is widely used to place subscripted text on webpages.

It is a paired tag.

It has start tag <sub> and closing tag </sub> Subscript text appears half a character below the normal line and is sometimes rendered in a smaller font.

We can see on science-related websites Subscript is used to writing chemical compounds. Example.  H2O O2 H2SO4

HTML Example

This Text is<sub>Sub-scripted</sub>Text.

HTML Output

This Text is Sub-scripted Text.

HTML Example 2

<p>H<sub>2</sub>O</p>
<p>O<sub>2</sub></p>
<p>H<sub>2</sub>SO<sub><4/sub></p>

HTML Output 2

H2O
O2
H2SO4

HTML <sup> Tag.

The <sup> tag is used to define the superscript text on webpages. Superscript and Subscript are often used in the mathematical expression and chemical compounds.

The Superscript tag can be modified by using CSS, by defining id we will talk more in CSS Tutorial.

Sometimes the superscript text can be used in footer side and to referencing. We can see wide use of superscript in Wikipedia.

HTML Example

(a+b)<sup>2 </sup>= a<sup>2</sup>+2ab+b<sup>2</sup>

HTML Output

(a+b)2 = a2+2ab+b2

Try By Yourself

(a-b)2=a2 – 2ab + b2 a2-b2=(a+b)(a-b)

Related Articles

Check Also
Close
Back to top button

Adblock Detected

Please turn off your Adblocker to view your content.