Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Superscript in CSS only?

Tags:

css

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...

like image 985
Henrik Paul Avatar asked Feb 01 '09 22:02

Henrik Paul


People also ask

How do you superscript in CSS?

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.

What is the use of SUP tag in CSS?

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.

How do you write H2O in CSS?

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.


1 Answers

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.

like image 176
Peter Boughton Avatar answered Sep 23 '22 21:09

Peter Boughton