You are currently viewing How to Use Superscript <sup> tag in HTML
  • Post category:HTML

How to Use Superscript tag in HTML

Superscript tag in HTML

If you don’t know how to add text above a character in HTML. If you do not know how to do it, this article is for you. In this article, I will explain, what is the superscript <sup> tag in HTML and how to use it. Many people don’t put the mathematical power above the number in HTML, some users don’t know it’s a power number, so the <sup> tag is there to solve this problem.

What is a superscript tag?

It is the element use to add text or number above a character. The superscript is <sup> tag. For example, if you are going to write “A2” in HTML, you must use the <sup> superscript tag. So, if you write A2 without using a superscript tag, the user will think A2 instead of A square. This tag is mainly use to write formulas or problems in mathematics, chemistry, physics, etc.

How to use the superscript tag

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p> Superscript tag is used in below mathematical formula:</p>
<p>(a+b)<sup>2</sup> = a<sup>2</sup>+b<sup>2</sup>+2ab</p>
</body>
</html>

Result:

superscript tag in html

1. First wrote the HTML general syntax, then create your element and write the content inside it.
2. Any letter or number that you want to display above must be given inside the <sup> tag as in the above code

The superscript <sup> tag is used by very rare members. If you are learning web development then know about <sup> & <sub> tag because it is also important in interview questions. And if you have any doubts, please let us know in the comments.

Leave a Reply