<style> .sub, .sup { position: relative; font-size: 80%; } </style> ... <span class=sub>a</span> (subscript) <span class=sup>a</span> (superscript)
Adjust the values โโas desired. In particular, you can use different classes for different situations, especially depending on the letter to which the superscript is attached. For example, after an uppercase letter such as โA,โ the inscription should be placed much higher.
Why classes and CSS?
Although HTML seems to have only the correct markup for this, sup and sub , they have a few drawbacks. Their rendering is inconsistent in browsers and is often typically poor: both vertical placement and size may be insufficient. It may seem easy to fix this in CSS, but it is not, due to an odd IE error with their calibration: it incorrectly interprets percentages. Moreover, sup and sub often create an uneven line spacing.
If you intend to use sup and sub , run a few tests before using them. Check multiple browsers and superscripts and indexes inside paragraphs of text (so you see a problem with line spacing).
source share