507

このリードに続いて、GithubREADME.mdでこれを試しました。

<span style="vertical-align: baseline; position: relative;top: -0.5em;>text in superscript</span>

動作しません。テキストは通常​​どおり表示されます。ヘルプ?

4

4 に答える 4

782

<sup></sup>タグを使用します(<sub></sub>下付き文字に相当します)。例については、この要点を参照してください。

于 2013-03-01T11:25:28.870 に答える
79
于 2018-08-17T09:17:42.167 に答える
17

Comments about previous answers

The universal solution is using the HTML tag <sup>, as suggested in the main answer.
However, the idea behind Markdown is precisely to avoid the use of such tags:
The document should look nice as plain text, not only when rendered.

Another answer proposes using Unicode characters, which makes the document look nice as a plain text document but could reduce compatibility.

Finally, I would like to remember the simplest solution for some documents: the character ^.
Some Markdown implementation (e.g. MacDown in macOS) interprets the caret as an instruction for superscript.

Ex.
Sin^2 + Cos^2 = 1
Clearly, Stack Overflow does not interpret the caret as a superscript instruction. However, the text is comprehensible, and this is what really matters when using Markdown.

于 2020-11-21T20:24:40.447 に答える
0

If you only need superscript numbers, you can use pure Unicode. It provides all numbers plus several additional characters as superscripts:

x⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿⁱ

However, it might be that the chosen font does not support them, so be sure to check the rendered output.

In fact, there are even quite a few superscript letters, however, their intended use might not be for superscript, and font support might be even worse. Use your own judgement.

于 2022-01-12T21:02:16.700 に答える