<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

瀏覽器相容性

另見