<dt> HTML 元素指定描述或定义列表中的术语,因此必须在 dl 元素内部使用。它通常后面跟着一个 dd 元素;然而,多个连续的 <dt> 元素表示由紧随其后的一个 dd 元素定义的多个术语。
随后的 dd(描述详情)元素提供与使用 <dt> 指定的术语相关的定义或其他相关文本。
HTML Demo: <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> 元素提供的示例。
技术概要
<table class="properties"> <tbody> <tr> <th scope="row"> <a href="/zh-CN/docs/Web/HTML/Guides/Content_categories" >内容分类</a > </th> <td>无。</td> </tr> <tr> <th scope="row">允许的内容</th> <td> <a href="/zh-CN/docs/Web/HTML/Guides/Content_categories#流式内容" >流式内容</a >、但不包括任何 header、footer、分段内容或标题内容的后代元素。 </td> </tr> <tr> <th scope="row">标签省略</th> <td> 开始标签是必要的。如果该元素后面紧跟着另一个 <code><dt></code> 元素或 dd 元素,或者父元素中没有更多内容,则可以省略结束标签。 </td> </tr> <tr> <th scope="row">允许的父元素</th> <td> 一个 dl 或(在 WHATWG HTML、W3C HTML 5.2 及以后版本中)作为 dl 子元素的 div。<br />该元素可以在 dd 或另一个 <code><dt></code> 元素之前使用。 </td> </tr> <tr> <th scope="row">隐含的 ARIA 角色</th> <td> <a href="https://www.w3.org/TR/html-aria/#dfn-no-corresponding-role" >没有对应的角色</a > </td> </tr> <tr> <th scope="row">允许的 ARIA 角色</th> <td> <code ><a href="/zh-CN/docs/Web/Accessibility/ARIA/Reference/Roles/listitem_role" >listitem</a ></code > </td> </tr> <tr> <th scope="row">DOM 接口</th> <td> HTMLElement 直到 Gecko 1.9.2(Firefox 4)版本为止,Firefox 为该元素实现了 HTMLSpanElement 接口。 </td> </tr> </tbody> </table>
规范
浏览器兼容性
参见
- dl
- dd
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
