Web Development

HTML – Subscript in HTML and SUP (Superscript)

Subscript in HTML

The tag <sub> is defined as subscript in html.  It is widely used to place subscripted text on web pages.

It is a paired tag. It has a 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 write 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 web pages. Superscript and Subscript are often used in 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 on the footer side and to reference. We can see wide use of superscripts 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)

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.

You may also like

HTML introduction
Web Development

HTML – Introduction, History & Syntax

  • December 21, 2019
So, first of all, I would like to ask a question for the first time when you heard this term
html heading tag
Web Development

HTML – Heading Tag With Syntax

  • December 21, 2019
A heading tag is one of the most important tags we focus on in HTML or web development because, without