HTML <sup> tag
The <sup> tag is used to define a superscript text, which appears half a character above the regular line and is rendered smaller than the rest of the text. The tag is commonly used to define footnotes and formulas.
You must use the <sup> tag only for typographical reasons. It shouldn’t be used for styling purposes. If you want to change the vertical position of a text, you can use the CSS vertical-align property with the «super» value.
Here are some use cases for a <sup> element:
- Representing superior lettering used in some languages when rendering specific abbreviations.
- Representing exponents (e.g. «x 2 .»).
- Representing ordinal numbers (e.g. «5 th » instead of «fifth»).
Syntax
The <sup> tag comes in pairs. The content is written between the opening (<sup>) and closing (</sup>) tags.
Как сделать степень в html
Выводит надстрочный текст.
Время чтения: меньше 5 мин
- Кратко
- Пример
- Как пишется
Обновлено 8 сентября 2022
Кратко
Скопировать ссылку на секцию «Кратко» Скопировано
Тег <sup> позволяет выводить надстрочный текст, например, в математических уравнениях: c 2 = a 2 + b 2 .
Пример
Скопировать ссылку на секцию «Пример» Скопировано
Чаще всего <sup> используется для вывода степеней в математических формулах.
Как пишется
Скопировать ссылку на секцию «Как пишется» Скопировано
Помимо описанного выше примера, можно использовать тег <sup> внутри тега <var> .
Теги <sup> можно вкладывать друг в друга, тогда на каждом шаге текст будет подниматься вверх, а его размер будет уменьшаться.
Также <sup> можно комбинировать с тегом <sub> для построения сложных формул.
<sup>: The Superscript element
The <sup> HTML element 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.
Try it
Attributes
This element only includes the global attributes.
Usage notes
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, 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):
- Displaying exponents, such as «x 3 .» It may be worth considering the use of MathML for these, especially in more complex cases. See Exponents under Examples below.
- Displaying superior lettering, which is used in some languages when rendering certain abbreviations. For example, in French, the word «mademoiselle» can be abbreviated «M lle «); this is an acceptable use case. See Superior lettering for examples.
- Representing ordinal numbers, such as «4 th » instead of «fourth.» See Ordinal numbers for examples.
Examples
Exponents
Exponents, or powers of a number, are among the most common uses of superscripted text. For example:
The resulting output looks like this:
Superior lettering
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:
The resulting output:
Ordinal numbers
Ordinal numbers, such as «fourth» in English or «quinto» in Spanish may be abbreviated using numerals and language-specific text rendered in superscript:
HTML тег <sup>
Элемент <sup> (от англ. «superscript» ‒ «надстрочный, верхний индекс») определяет вложенный в него текст в верхнем индексе.
Текст в верхнем индексе отображается уменьшенным размером и располагается выше, чем базовая линия остальных символов строки. Базовая линия — это линия, которая проходит по нижнему или верхнему краю символов.
Такой текст на практике может быть использован, например для написания различных формул или сносок. Сноска — это ссылка на дополнительные пояснения к тексту, например WWW [1] .
Синтаксис
Закрывающий тег
Атрибуты
Для этого элемента доступны глобальные атрибуты и события.
Стилизация по умолчанию
Большинство браузеров отобразит элемент <sup> со следующими значениями CSS по умолчанию: