<dt>:定義術語元素
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
<dt> HTML 元素用於指定描述或定義清單中的術語,因此必須在 <dl> 元素內使用。通常後面會跟著一個 <dd> 元素;但是連續多個 <dt> 元素表示所有這些術語都由接下來的 <dd> 元素定義。
隨後的 <dd>(描述詳細資訊)元素提供了使用 <dt> 指定的術語的定義或其他相關文字。
嘗試一下
<p>Please use the following paint colors for the new house:</p> <dl> <dt>Denim (semigloss finish)</dt> <dd>Ceiling</dd> <dt>Denim (eggshell finish)</dt> <dt>Evening Sky (eggshell finish)</dt> <dd>Layered on the walls</dd> </dl> p, dl { font: 1rem "Fira Sans", sans-serif; } dl > dt { font-weight: normal; font-style: oblique; } dd { margin-bottom: 1rem; } 屬性
這個元素只包括全域屬性。
範例
有關範例,請參見 <dl> 元素提供的範例。
技術摘要
| 內容類型 | 無。 |
|---|---|
| 允許的內容 | 流內容,但不能包含 <header>、<footer>、章節型內容或標題內容的後代元素。 |
| 標籤省略 | 開始標籤是必需的。如果此元素立即跟隨另一個 <dt> 元素或一個 <dd> 元素,或者父元素中沒有更多內容,則可以省略結束標籤。 |
| 允許的父元素 | 一個 <dl> 或者(在 WHATWG HTML、W3C HTML 5.2 及更高版本中)是 <dl> 的子元素的 <div>。這個元素可以在 <dd> 或另一個 <dt> 元素之前使用。 |
| 隱含的 ARIA 角色 | 沒有相對應的角色 |
| 允許的 ARIA 角色 | listitem |
| DOM 介面 | HTMLElement 在 Gecko 1.9.2(Firefox 4)及以前版本中,Firefox 為這個元素實現了 HTMLSpanElement 介面。 |
規範
| Specification |
|---|
| HTML> # the-dt-element> |