How do I make superscript and subscript text in HTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I make superscript and subscript text in HTML?

How do I make superscript and subscript text in HTML?

12th Jul 2022, 3:43 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
3 Answers
+ 3
By putting the text inside <sub></sub> or <sup></sup> tags.
12th Jul 2022, 4:00 PM
Avinesh
Avinesh - avatar
+ 1
And you can also apply CSS and do absolutely the same, especially since you can customize the text and make it superscripted or subscripted as you want by using pixels. ( positive value for superscript, negative value for subscript ) Look: <style> <!— for superscripted text —> p{ vertical-align: sup; } <!— for subscripted text —> p{ vertical-align: sub; } <!— for superscripted text —> p{ vertical-align: 10px; } <!— for subscripted text —> p{ vertical-align: -10px; } </style> I hope this helped you!( for more explanations, you can read lesson 14.1 of the CSS course ) ^^ Have a good day!
12th Jul 2022, 5:05 PM
Vlad Apet
0
Thanks!
12th Jul 2022, 6:08 PM
MyNameIsNotBob
MyNameIsNotBob - avatar