Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!

Summary

The HTML Subscript Element (<sub>) defines a span of text that should be displayed, for typographic reasons, lower, and often smaller, than the main span of text.

Usage note:

  • This element should be used for typographical reasons only, i.e. changing the position of the text changing its meaning like in mathematical (like t2, though the use of a MathML formula should be considered) or chemical formulas (like H2O).
  • This element must not be used for styling purpose like the styling of the product name Latex. In that case CSS style should be used: the vertical-align property with the sub value will achieve the same effect.

Usage context

Content categories Flow content and phrasing content
Permitted content Phrasing content
Tag omission None as both the start and end tag are mandatory
Permitted parent elements Any element that can contain phrasing content
Normative document HTML5, section 4.6.14 (HTML4.01, section 9.2.3)

Attributes

This element only includes the global attributes.

DOM interface

This element implements the HTMLElement interface.

Implementation note: up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement interface for this element.

Examples

<p>The chemical formula of water is H<sub>2</sub>O</p>

Result

The chemical formula of water is H2O

See also

  • The <sup> HTML element that produces superscript. 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.
  • The <msub>, <msup>, and <msubsup> MathML elements.

文件標籤與貢獻者

 最近更新: kscarfone,