How can I get superscript done, only in CSS?
I have a stylesheet where I mark the external links with a superscript character, but I'm having a hard time getting the character aligned correctly.
What I have currently, looks like this:
a.external:after { font-size: 50%; vertical-align: top; content: "+"; }
but it doesn't work.
Naturally, I'd use the <sup>
-tag, only if content
would allow for HTML...
In HTML, there is the use of <sub> and <sup> tags to define the subscript and superscript text. The superscript text appears in a smaller font and the half character above the normal line. It is generally used to write mathematical equations (like x2 + y2 = r2), footnotes, and many more.
The <sup> tag defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font. Superscript text can be used for footnotes, like WWW. Tip: Use the <sub> tag to define subscript text.
Subscript text appears half a character below the normal line and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O to be written as H2O. Superscript: The <sup> tag is used to add a superscript text to the HTML document.
You can do superscript with vertical-align: super
, (plus an accompanying font-size
reduction).
However, be sure to read the other answers here, particularly those by paulmurray and cletus, for useful information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With