HTML <sup> tag

HTML <sup> tag : Definition

• The HTML <sup> element stands for superscript this is used to add the superscript text to the HTML document.

• The superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font.

• The <sup> element can be used for writting typographical, mathematical formulas like (a+b)2 = a2+b2+2ab, sin(90°−x) = cos x etc.

Html <sup> tag example

<!DOCTYPE html>
<title>sub Tag example</title>
  <p>(a+b)<sup>2</sup> = a<sup>2</sup>+b<sup>2</sup>+2ab</p>
  <p>a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup></p>
  <p>(a/c)<sup>2</sup> + (b/c)<sup>2</sup> = 1</p>
  <p>sin<sup>2</sup> θ + cos<sup>2</sup> θ = 1 </p>
  <p>sec (2x) = sec<sup>2</sup> x/(2-sec<sup>2</sup> x)</p> 

Output :


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

a2 + b2 = c2

(a/c)2 + (b/c)2 = 1

sin2 θ + cos2 θ = 1

sec (2x) = sec2 x/(2-sec2 x)