Superscript (sup) and Subscript (sub) tags not working in browsers? Here is the fix..


Usually Superscript (sup) and Subscript (sub) tags are used for displaying Matematical equations and chemical formulaes. If you are trying a code similar to the one given below and your Superscript <sup></sup> and Subscript <sub></sub> tags not working in browser. Then try the fix given here using CSS.


HTML Code:
25<sup>th</sup> Anniversary..

H<sub>2</sub>SO<sub>4</sub> is an acid.


Add this style to your css file and reload the page, the tags will now work.

CSS Code:

sup {font-size:xx-small; vertical-align:super;}
sub {font-size:xx-small; vertical-align:sub;}


Result:

25th Anniversary..

H2SO4 is an acid.

Comments