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.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
| 内容类别 | 流内容 , 措词内容 ,可触及内容。 |
|---|---|
| 准许内容 | 措词内容 . |
| Tag omission | None, both the starting and ending tag are mandatory. |
| Permitted parents | Any element that accepts 措词内容 . |
| Implicit ARIA role | 无对应角色 |
| Permitted ARIA roles | 任何 |
| DOM 接口 |
HTMLElement
|
此元素只包括 全局属性 .
<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, 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 (but aren't necessarily limited to):
Exponents, or powers of a number, are among the most common uses of superscripted text. For example:
<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:
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of '<sub> and <sup>' in that specification. |
实时标准 | |
|
HTML5
The definition of '<sub> and <sup>;' in that specification. |
推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
sup
|
Chrome 完整支持 Yes | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 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>
,和
<msubsup>
MathML elements.
vertical-align
特性。