- HTML Text Formatting
- Example
- HTML Formatting Elements
- HTML and Elements
- Example
- Example
- HTML and Elements
- Example
- Example
- HTML Element
- Example
- HTML Element
- Example
- HTML Element
- Example
- HTML Element
- Example
- HTML Element
- Example
- HTML Element
- Example
- HTML Exercises
- HTML Text Formatting Elements
- HTML Tag
- Browser Support
- Global Attributes
- Event Attributes
- Related Pages
- Default CSS Settings
- Example
- COLOR PICKER
- Report Error
- Thank You For Helping Us!
- Sup tag in html
- Синтаксис
- Закрывающий тег
- Атрибуты
- Аналог CSS
- Статьи по теме
- Статьи по теме
- Типы тегов
- : The Superscript element
- Try it
- Attributes
- Usage notes
- Examples
- Exponents
- Result
- Superior lettering
- Result
- Ordinal numbers
- Result
- Technical summary
- Specifications
- Browser compatibility
- See also
- Found a content problem with this page?
- MDN
- Support
- Our communities
- Developers
- Superscript in HTML
- Syntax
- Attributes (Global+Event)
- How to use tag in HTML??
- Examples
- Example 1: Exponents
- Example 2: Superior Lettering
- Example 3: Ordinal Numbers
- Set Style of Superscript with CSS
- Accessibility Concerns
- Browser Support
- Conclusion
HTML Text Formatting
HTML contains several elements for defining text with a special meaning.
Example
This is subscript and superscript
HTML Formatting Elements
Formatting elements were designed to display special types of text:
- — Bold text
- — Important text
- — Italic text
- — Emphasized text
- — Marked text
- — Smaller text
- — Deleted text
- — Inserted text
- — Subscript text
- — Superscript text
HTML and Elements
The HTML element defines bold text, without any extra importance.
Example
The HTML element defines text with strong importance. The content inside is typically displayed in bold.
Example
HTML and Elements
The HTML element defines a part of text in an alternate voice or mood. The content inside is typically displayed in italic.
Tip: The tag is often used to indicate a technical term, a phrase from another language, a thought, a ship name, etc.
Example
The HTML element defines emphasized text. The content inside is typically displayed in italic.
Tip: A screen reader will pronounce the words in with an emphasis, using verbal stress.
Example
HTML Element
The HTML element defines smaller text:
Example
HTML Element
The HTML element defines text that should be marked or highlighted:
Example
Do not forget to buy milk today.
HTML Element
The HTML element defines text that has been deleted from a document. Browsers will usually strike a line through deleted text:
Example
My favorite color is blue red.
HTML Element
The HTML element defines a text that has been inserted into a document. Browsers will usually underline inserted text:
Example
HTML Element
The HTML element defines subscript text. 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:
Example
HTML Element
The HTML element 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 [1] :
Example
This is superscripted text.
HTML Exercises
HTML Text Formatting Elements
Tag | Description |
---|---|
Defines bold text | |
Defines emphasized text | |
Defines a part of text in an alternate voice or mood | |
Defines smaller text | |
Defines important text | |
Defines subscripted text | |
Defines superscripted text | |
Defines inserted text | |
Defines deleted text | |
Defines marked/highlighted text |
For a complete list of all available HTML tags, visit our HTML Tag Reference.
HTML Tag
The 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 [1] .
Browser Support
Global Attributes
Event Attributes
Related Pages
Default CSS Settings
Most browsers will display the element with the following default values:
Example
COLOR PICKER
Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top References
Top Examples
Get Certified
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.
Sup tag in html
Отображает шрифт в виде верхнего индекса. Шрифт при этом отображается выше базовой линии текста и уменьшенного размера.
Синтаксис
Закрывающий тег
Атрибуты
Аналог CSS
Великая теорема Ферма
X n + Y n = Z n
где n - целое число > 2
Результат данного примера показан ниже.
Рис. 1. Вид текста, оформленного с помощью тега
Статьи по теме
Статьи по теме
Не выкладывайте свой код напрямую в комментариях, он отображается некорректно. Воспользуйтесь сервисом cssdeck.com или jsfiddle.net, сохраните код и в комментариях дайте на него ссылку. Так и результат сразу увидят.
Типы тегов
HTML5
Блочные элементы
Строчные элементы
Универсальные элементы
Нестандартные теги
Осуждаемые теги
Видео
Документ
Звук
Изображения
Объекты
Скрипты
Списки
Ссылки
Таблицы
Текст
Форматирование
Формы
Фреймы
: The Superscript element
The 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 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 . This would be done using, for example, vertical-align: super or, to shift the baseline up 50%, vertical-align: 50% .
Appropriate use cases for 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:
p> One of the most common equations in all of physics is var>Evar>=var>mvar >var>cvar>sup>2sup>. p>
Result
Superior lettering
Superior lettering is not technically the same thing as superscript. However, it is common to use 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 à Msup>llesup> Bernard.p>
Result
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:
p> The ordinal number "fifth" can be abbreviated in various languages as follows: p> ul> li>English: 5sup>thsup>li> li>French: 5sup>èmesup>li> ul>
Result
Technical summary
Content categories | Flow content, phrasing content, palpable content. |
---|---|
Permitted content | Phrasing content. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | Any element that accepts phrasing content. |
Implicit ARIA role | No corresponding role |
Permitted ARIA roles | Any |
DOM interface | HTMLElement |
Specifications
Browser compatibility
BCD tables only load in the browser
See also
- The HTML element that produces subscripts. Note that you cannot use sub and sup at the same time: 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.
- The , , and MathML elements.
- The CSS vertical-align property.
Found a content problem with this page?
This page was last modified on Apr 13, 2023 by MDN contributors.
Your blueprint for a better internet.
MDN
Support
Our communities
Developers
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998– 2023 by individual mozilla.org contributors. Content available under a Creative Commons license.
Superscript in HTML
The tag in HTML is used to define a text as a superscript in HTML. A superscript is a text that appears half above the normal baseline and is rendered in smaller-sized text.
Example: 2 3 , 5 th , etc.
Syntax
To use the tag, we just have to write the text in between the opening and closing tag like text
Now, this will be rendered as:
Attributes (Global+Event)
There are no specific attributes applied to the tag, and Only global attributes are applied to the tag.
Note: The superscript in HTML, the tag, is used to comply with the typographical conventions/standards. It is generally used to display ordinal numbers, exponents, and superior lettering, and the tag is found inside the tag.
How to use tag in HTML??
The tag is used in HTML to show a text as a superscript, which appears half above the baseline and is rendered using a smaller text.
Example: a 2 , 9 th
Note: The tag should only be used to change the position of the text so that it complies with the typographical conventions/standards and should not be used solely for the presentation/appearance purpose.
Example: If we need to style the wordmark of a product that uses text with a raised baseline, it should be done using CSS and not using the tag. This can be done using vertical-align:super or vertical-align: 50% .
The appropriate uses of the tag (but not limited to) are discussed below:
- Showing Exponent`, such as a 2 .
- Showing superior lettering. Earlier in English-speaking countries, abbreviations were used for the recordkeeping of a given name.
Example: for Alexander, the abbreviation Alex r was used in record-keeping. - Showing Ordinal numbers, such as Ninth as 9 th
Examples
Example 1: Exponents
The most common use of superscript in HTML is to display the exponent or power of a number.
Example:
The formula of Pythagoras theorem is a 2 + b 2 = c 2
Example 2: Superior Lettering
The tag is used for superior lettering in HTML. Earlier in English-speaking countries, abbreviations were used for the recordkeeping of a name.
We can write Alexander as Alex r for record-keeping
Example 3: Ordinal Numbers
Superscript in HTML is used to display ordinal numbers. This can be represented using language-specific text and numerals displayed as superscripts.
Class fifth can be also written as 5 th
Set Style of Superscript with CSS
We can style superscripts in HTML using CSS in two ways:
Accessibility Concerns
There are some accessibility concerns related to superscripts in HTML that we should keep in mind while using the tag.
As there is no other way to represent power(exponent) in Html, we have to use the tag. The tag means superscript and not exponent, so when we are using the screen reader, the HTML text 23, here we cannot expect the browser to read it as “two superscript three” or “two to the power three”, if the browser does it like this then the text in Superior lettering will sound very odd.
We can also use a Unicode equivalent code to display the numbers in the exponent instead of using superscript.
Browser Support
The list of browsers that support the tag is listed below:
Conclusion
- The tag is used to display a text as superscript in HTML.
- We can use superscript in HTML to display a 2 by writing a2 in HTML.
- The common use of superscripts in HTML is to display Exponents, Superior lettering, and Ordinal number.