Html как написать степень числа

Internet Explorer Chrome Opera Safari Firefox Android iOS
2.0+ 1.0+ 2.0+ 1.0+ 1.0+ 1.0+ 1.0+

Спецификация

HTML: 3.2 4.01 5.0 XHTML: 1.0 1.1

Описание

Отображает шрифт в виде верхнего индекса. Шрифт при этом отображается выше
базовой линии текста и уменьшенного размера.

Синтаксис

<sup>Текст</sup>

Закрывающий тег

Обязателен.

Атрибуты

Для этого тега доступны универсальные атрибуты и события.

Аналог CSS

vertical-align

Пример

HTML5IECrOpSaFx

<!DOCTYPE HTML>
<html>
 <head>
  <meta charset="utf-8">
  <title>Тег SUP</title>
 </head>
 <body>

  <p><b>Великая теорема Ферма</b></p>
  <p><i>X <sup><small>n</small></sup> + Y <sup><small>n</small></sup> 
   = Z <sup><small>n</small></sup></i></p>
  <p>где n - целое число > 2</p>

 </body>
</html>

Результат данного примера показан ниже.

Рис. 1

Рис. 1. Вид текста, оформленного с помощью тега <sup>

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:

<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

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

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:

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

Specification
HTML Standard
# the-sub-and-sup-elements

Browser compatibility

BCD tables only load in the browser

See also

  • The <sub> 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 <msub>, <msup>, and <msubsup> MathML elements.
  • The CSS vertical-align property.

Тег <sup> (от англ. superscript — надстрочный индекс) отображает шрифт в виде верхнего индекса. Шрифт при этом отображается выше базовой линии текста и уменьшенного размера.

Текстовые элементы

  • a
  • abbr
  • b
  • bdi
  • bdo
  • br
  • cite
  • code
  • data
  • del
  • dfn
  • em
  • i
  • ins
  • kbd
  • mark
  • q
  • ruby
  • rtc
  • rb
  • rp
  • rt
  • s
  • samp
  • small
  • span
  • strong
  • sub
  • sup
  • time
  • u
  • var
  • wbr

Синтаксис¶

Закрывающий тег обязателен.

Атрибуты¶

Для этого элемента доступны универсальные атрибуты.

Спецификации¶

  • HTML Living Standard
  • HTML 5

Описание и примеры¶

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>SUP</title>
  </head>
  <body>
    <p><b>Великая теорема Ферма</b></p>
    <p>
      <i
        >X <sup><small>n</small></sup> + Y
        <sup><small>n</small></sup> = Z
        <sup><small>n</small></sup></i
      >
    </p>
    <p>где n - целое число > 2</p>
  </body>
</html>

Ссылки¶

  • Тег <sup> MDN (рус.)

HTML теги

Значение и применение

Тег <sup> определяет текст с верхним индексом.

Элемент <sup> выравнивает элемент как надстрочный благодаря свойству CSS по умолчанию vertical-align со значением super, и по аналогии с элементами <small> (определяет текст меньшего размера) и <sub> (определяет текст с нижним индексом) устанавливает размер шрифта меньшего размера, чем у родительского элемента (значение CSS по умолчанию — font-size: smaller).

Поддержка браузерами

Пример использования

<!DOCTYPE html>
<html>
	<head>
		<title>Пример использования тега <sup><title>
	</head>
	<body>
		Дискриминант квадратного трёхчлена ax2+bx+c равен D=b2-4ac на языке HTML записывается следующим образом:
		ax<sup>2</sup>+bx+c равен D=b<sup>2</sup>-4ac
	</body>
</html>

Виды возможного форматирования текста:

Виды форматирования текста.

Виды форматирования текста.

Отличия HTML 4.01 от HTML 5

Нет.

Значение CSS по умолчанию

sup {
vertical-align: super;
font-size: smaller;
}

Поддержка глобальных атрибутов

Элемент поддерживает «глобальные атрибуты».

Атрибуты событий

Элемент поддерживает «атрибуты событий».

HTML теги



Как поставить степень числа в html документе?

Просмотров: 2902 | Добавил: (13.03.2018) (Изменено: 13.03.2018)

Всего ответов: 3

Обсуждение вопроса:

Всего ответов: 3

Порядок вывода комментариев:


Аватар

0

Люсси

13.03.2018 оставил(а) комментарий:

Используйте эти символы 1 ⁱ ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺ ⁻ ⁼ ⁽ ⁾ ⁿ


Аватар

0

Тамми

13.03.2018 оставил(а) комментарий:

В HTML для этого есть теги <sup> (как степень) и <sub> (как индекс).


Аватар

0

Ален_Делон

13.03.2018 оставил(а) комментарий:

Для этого в языке HTML (HyperText Markup Language — «язык разметки гипертекста») предусмотрена соответствующая команда (тег) — sup. Число, обозначающее степень, надо поместить между открывающим (<sup>) и закрывающим (</sup>) тегами. Например, фрагмент HTML-кода с записью числа 5297 в седьмой степени, в исходном коде документа будет выглядеть так:5297<sup>7</sup>Противоположный (нижний) индекс в языке разметки гипертекста получается помещением цифр и букв между открывающим и закрывающим тегами sub — <sub>7</sub>

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.

The <sub> tag is used to define the subscript.

Here are some use cases for a <sup> element:

  • Representing superior lettering used in some languages when rendering specific abbreviations.
  • Representing exponents (e.g. «x2.»).
  • Representing ordinal numbers (e.g. «5th» instead of «fifth»).

The <sup> tag comes in pairs. The content is written between the opening (<sup>) and closing (</sup>) tags.

Example of the HTML <sup> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <p>
      E = mc<sup>2</sup>, where E is the energy of the object, m is the weight, c is the light speed in vacuum.
    </p>
  </body>
</html>

Result

 sup example

Example of the HTML <sup> tag used with the CSS vertical-align property:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      sup {
        vertical-align: sup;
        font-size: medium;
      }
    </style>
  </head>
  <body>
    <h1>Example of the sub tag</h1>
    <p>
      Here is some text <sup> with the sup tag</sup>.
    </p>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis ...
    </p>
    <p>
      Reference site about Lorem Ipsum,
      <sup> giving information on its origins</sup>, as well as a random Lipsum generator.
    </p>
  </body>
</html>

Example of the HTML <sup> tag used with the <sub> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      sup {
        vertical-align: sup;
        font-size: medium;
      }
      
      sub {
        vertical-align: sub;
        font-size: small;
      }
    </style>
  </head>
  <body>
    <h1>Example of the sub tag</h1>
    <p>
      Here is some text
      <sub> with the sup tag</sub>.
    </p>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis ...
    </p>
    <p>
      Reference site about Lorem Ipsum,
      <sup> giving information on its origins</sup>, as well as a random Lipsum generator.</p>
  </body>
</html>

The <sup> tag supports Global attributes and the Event Attributes.

How to style <sup> tag?

Common properties to alter the visual weight/emphasis/size of text in <sup> tag:

  • CSS font-style property sets the style of the font. normal | italic | oblique | initial | inherit.
  • CSS font-family property specifies a prioritized list of one or more font family names and/or generic family names for the selected element.
  • CSS font-size property sets the size of the font.
  • CSS font-weight property defines whether the font should be bold or thick.
  • CSS text-transform property controls text case and capitalization.
  • CSS text-decoration property specifies the decoration added to text, and is a shorthand property for text-decoration-line, text-decoration-color, text-decoration-style.

Coloring text in <sup> tag:

  • CSS color property describes the color of the text content and text decorations.
  • CSS background-color property sets the background color of an element.

Text layout styles for <sup> tag:

  • CSS text-indent property specifies the indentation of the first line in a text block.
  • CSS text-overflow property specifies how overflowed content that is not displayed should be signalled to the user.
  • CSS white-space property specifies how white-space inside an element is handled.
  • CSS word-break property specifies where the lines should be broken.

Other properties worth looking at for <sup> tag:

  • CSS text-shadow property adds shadow to text.
  • CSS text-align-last property sets the alignment of the last line of the text.
  • CSS line-height property specifies the height of a line.
  • CSS letter-spacing property defines the spaces between letters/characters in a text.
  • CSS word-spacing property sets the spacing between words.

Синтаксис

Описание

Элемент sup (от англ. «superscript» ‒ «надстрочный, верхний индекс») определяет вложенный в него текст как верхний индекс. Текст, вложенный в элемент sup имеет размер немного меньший, чем размер основного текста.

Примечание

Индекс по отношению к основному тексту на полкорпуса смещен вверх. Данный элемент может быть так же использован внутри элемента var для обозначения верхних индексов переменных.

Совет

С помощью подобного элемента в документе удобно создавать сноски (например, «текст[1]»), а так же в математических выражениях указывать степень числа/переменной (например, «52=25; X2=4») в формуле. Для вывода больших или сложных формул рекомендуется использовать язык математической разметки MathML, но если выражение/формула небольшая и может корректно отображаться без использования MathML, то допускается использование в формуле элементов sub и sup.







Поддержка браузерами


Спецификация


Атрибуты

Глобальные атрибуты
accesskey, class, contenteditable, data-*, dir, draggable, dropzone, hidden, id, inert, lang, spellcheck, style, tabindex, title, translate, xml:lang

Пример использования

<!DOCTYPE html>
<html>
<head>
<meta charset=«utf-8»>
<title>Элемент sup</title>
</head>
<body>
<h1>Пример использования элемента «sup»</h1>
<h2>Формула зависимости энергии от скорости света</h2>
<p><var>E</var>=<var>m</var><var>c</var><sup>2</sup> — энергия равна массе, умноженной на квадрат скорости света в свободном пространстве.</p>
</body>
</html>

Понравилась статья? Поделить с друзьями:
  • Honda на японском как пишется
  • Homo sapiens как пишется
  • Hola как пишется
  • Hitachi как пишется
  • Hippos or hippoes как правильно пишется