DEV Community

Cover image for 🚀 Elevate your text game with HTML! Need to raise text?
Mritunjay Saha
Mritunjay Saha

Posted on

🚀 Elevate your text game with HTML! Need to raise text?

Ever wondered how to add a superscript or subscript in HTML as we did while solving maths in high school?

We are used to add the superscript or subscript in google docs or microsoft word using which looked like this.
Superscript and Subscript

How to achieve superscript and subscript in HTML?

In HTML we can achieve the same using the tags for superscript and for subscript

<p>Example of superscript: (a + b)<sup>2</sup></p>
<p>Example of subscript: F<sub>n</sub> = F<sub>n-1</sub> + F<sub>n-2</sub></p>
Enter fullscreen mode Exit fullscreen mode

Output

Example of superscript: (a + b)2

Example of subscript: Fn = Fn-1 + Fn-2

Top comments (0)