The HTML Superscript element (<sup>
) specifies inline text which is to be displayed as superscript for solely typographical reasons. Superscripts are usually rendered with a raised baseline using smaller text.
Content categories | Flow content and phrasing content |
---|---|
Permitted content | Phrasing content |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | Any element that can contain phrasing content |
Permitted ARIA roles | Any |
DOM Interface | HTMLElement |
This element only includes the global attributes.
The <sup>
element should only be used for typographical reasons—that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes.
For example, using <sup>
to style the wordmark of a business or product which uses a raised baseline should be done using CSS (most likely vertical-align
) rather than <sup>
. This would be done using, for example, vertical-align: super
or, to shift the baseline up 50%, vertical-align: 50%
.
Appropriate use cases for <sup>
include:
Exponents, or powers of a number, are among the most common uses of superscripted text.
<p>One of the most common equations in all of physics is <var>E</var>=<var>m</var><var>c</var><sup>2</sup>.<p>
The resulting output looks like this:
Superior lettering, is not technically the same thing as superscript. However, it is common to use <sup>
to present superior lettering in HTML. Among the most common uses of superior lettering is the presentation of certain abbreviations in French:
<p>Robert a présenté son rapport à M<sup>lle</sup> Bernard.</p>
The resulting output:
Ordinal numbers, such as "fourth" in English or "quinto" in Spanish may be abbreviated using numerals and language-specific text rendered in superscript:
<p>The ordinal number "fifth" can be abbreviated in various languages as follows:</p> <ul> <li>English: 5<sup>th</sup></li> <li>French: 5<sup>ème</sup></li> </ul>
The output:
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of '<sub> and <sup>' in that specification. | Living Standard | |
HTML5 The definition of '<sub> and <sup>;' in that specification. | Recommendation |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | Yes | Yes | 1 | Yes | Yes | Yes |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | Opera Android | iOS Safari | Samsung Internet |
---|---|---|---|---|---|---|---|
Basic support | Yes | Yes | Yes | 4 | Yes | Yes | ? |
<sub>
HTML element that produces subscripts. Note that you cannot use them both at the same time and you need to use MathML to produce both a superscript and a subscript next to the chemical symbol of an element, representing its atomic number and its nuclear number.<msub>
, <msup>
, and <msubsup>
MathML elements.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup