<small>: side-comment 元素

Baseline 已广泛支持

此特性已相当成熟,可在许多设备和浏览器版本上使用。自 ⁨2015 年 7 月⁩以来,各浏览器均已提供此特性。

<small> HTML 元素表示 side-comment 和小字,例如版权和法律文本,与其样式表示无关。默认情况下,它会将其内的文本渲染得比正常字体小一个字号,例如从 smallx-small

试一试

<p>
  MDN Web Docs is a learning platform for Web technologies and the software that
  powers the Web.
</p>

<hr />

<p>
  <small
    >The content is licensed under a Creative Commons Attribution-ShareAlike 2.5
    Generic License.</small
  >
</p>
small {
  font-size: 0.7em;
}

属性

此元素仅包含全局属性

示例

基本用法

html
<p>
  This is the first sentence.
  <small>This whole sentence is in small letters.</small>
</p>

结果

CSS 替代方案

html
<p>
  This is the first sentence.
  <span class="small">This whole sentence is in small letters.</span>
</p>
css
.small {
  font-size: 0.8em;
}

结果

注意

虽然 <small> 元素,就像 <b><i> 元素一样,可能被认为违反了结构与表示分离的原则,但这三个在 HTML 中都是有效的。鼓励作者在使用 <small> 或 CSS 时自行判断。

技术摘要

内容类别 流内容短语内容
允许内容 短语内容
标签省略 无;必须同时拥有开始标签和结束标签。
允许父级 任何接受短语内容的元素,或任何接受流内容的元素。
隐式 ARIA 角色 generic
允许的 ARIA 角色 任意
DOM 接口 HTMLElement

规范

规范
HTML
# the-small-element

浏览器兼容性

另见