<sub>:下标元素
<sub>
HTML 元素指定内联文本,仅出于印刷原因应将其显示为下标。下标通常使用较小的文本以较低的基线呈现。
¥The <sub>
HTML element specifies inline text which should be displayed as subscript for solely typographical reasons. Subscripts are typically rendered with a lowered baseline using smaller text.
Try it
属性
使用说明
¥Usage notes
<sub>
元素只能用于印刷原因,即更改文本的位置以符合印刷惯例或标准,而不仅仅是用于演示或外观目的。
¥The <sub>
element should be used only 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.
例如,使用 <sub>
来设置在 wordmark 中使用更改基线的公司名称的样式是不合适的;相反,应该使用 CSS。例如,你可以将 vertical-align
属性与 vertical-align: sub
之类的声明一起使用,或者为了更精确地控制基线偏移,使用 vertical-align: -25%
。
¥For example, using <sub>
to style the name of a company which uses altered baselines in their wordmark would not be appropriate; instead, CSS should be used. For example, you could use the vertical-align
property with a declaration like vertical-align: sub
or, to more precisely control the baseline shift, vertical-align: -25%
.
<sub>
的适当用例包括(但不一定限于):
¥Appropriate use cases for <sub>
include (but aren't necessarily limited to):
示例
脚注编号
¥Footnote numbers
传统的脚注使用下标表示的数字来表示。这是 <sub>
的常见用例:
¥Traditional footnotes are denoted using numbers which are rendered in subscript. This is a common use case for <sub>
:
<p>
According to the computations by Nakamura, Johnson, and Mason<sub>1</sub> this
will result in the complete annihilation of both particles.
</p>
结果
¥Result
变量下标
¥Variable subscripts
在数学中,与同一概念(例如沿同一轴的距离)相关的变量族使用相同的变量名称并带有下标来表示。例如:
¥In mathematics, families of variables related to the same concept (such as distances along the same axis) are represented using the same variable name with a subscript following. For example:
<p>
The horizontal coordinates' positions along the X-axis are represented as
<var>x<sub>1</sub></var> … <var>x<sub>n</sub></var>.
</p>
结果
¥Result
化学式
¥Chemical formulas
当书写化学式时,例如 H20,所描述分子内给定元素的原子数用下标数字表示;对于水,下标 "2" 表示分子中有两个氢原子。
¥When writing a chemical formula, such as H20, the number of atoms of a given element within the described molecule is represented using a subscripted number; in the case of water, the subscripted "2" indicates that there are two atoms of hydrogen in the molecule.
另一个例子:
¥Another example:
<p>
Almost every developer's favorite molecule is
C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>, which is commonly known
as "caffeine."
</p>
结果
¥Result
技术总结
规范
Specification |
---|
HTML Standard # the-sub-and-sup-elements |
浏览器兼容性
BCD tables only load in the browser