Friday, September 16, 2011

How to Add Superscript and Subscript Text in Webpage / Website


To present mathematical expressions / terms in a webpage, sometimes you may need to show Superscript Text and/or Subscript Text. There are a lots of rules in mathematics where you need these types of texts. (a+b)2=a2+2ab+b2 is also a rules of math. So if you want to show it on a webpage then you have to know about Superscript Text Formatting. Because here I have presented 2 as square and it is known as Superscript Text. I have done it with some simple codes. Again sometimes you have to represent mathematical equation like log223=3log22. In this equation I have written both Superscript Text and Subscript Text. Lets see them log2(SUBSCRIPT)23(SUPERSCRIPT)=3log2(SUBSCRIPT)2.
Hope you are now clear about Superscript Text and Subscript Text. Lets see how to represent them on a webpage.

Superscript Text
Lets see another example of Superscript Text...
E=mc2
This is one of the greatest Equation of Science provided by Albert Einstein. 2 is here Superscript Text. Sometimes you may have to write this types of equations in Webpages. You have to use some codes to show this Superscript Text. The codes you need is given below into the box.
<html>
<body>
<font face="verdana">E=mc<sup>2</sup></font>
</body>
</html>

Just type the above codes in a Notepad and save it as Superscript.html, then open the HTML(.html) file and get the Superscript Text as like as the above example. In the above codes I have used <sup> and </sup> to show the Superscript Text. You also need to keep the text between <sup> and </sup> that you want to represent as Superscript Text.

Subscript Text
Lets see another example of Subscript Text...
logab
This is way to write log equations. a is here Subscript Text. You just have to use <sub> and </sub> to represent any text as Subscript Text. The codes for Subscript Text is given below in the box.
<html>
<body>
<font face="verdana">log<sub>a</sub>b</font>
</body>
</html>

Write the above codes in a Notepad and save the Notepad Document as Subscript.html. Then double click on the Subscript.html file and get the Subscript Text as like as the above example. You have to keep your text between <sub> and </sub> to get Subscript Text.

No comments:

Post a Comment