根据 HTML5Doctor's article on the dl element :“<dl>
可用于标记术语表,但您必须记住使用 <dfn>
来指示该词已定义 [在同一文档中]。”注意:括号内的语言是我自己的。文章给出了这个标记来解释:
<dl>
<dt><dfn>RSS</dfn></dt>
<dd>An XML format for aggregating information from websites whose
content is frequently updated.</dd>
</dl>
请注意,术语“RSS”包含在 dt
中。和 dfn
标签。
我的问题是:为什么我们必须记住使用 dfn
?这没有令人信服的解释。我正在寻找关于 dfn
的明确解释用法以及一些具体示例。
注意:我查看了The dfn tag documentation by the W3C但这并没有回答我的问题。
其他背景和引用资料
有趣的是(或不是),根据HTML5Doctor article dl
元素在 HTML5 中被重命名为“描述列表”。以前它是“定义列表”。来自W3C Working Draft on the Description List :
The dl element represents a description list, which consists of zero or more term-description (name-value) groupings; each grouping associates one or more terms/names (the contents of dt elements) with one or more descriptions/values (the contents of dd elements).
最佳答案
Interestingly (or not), according to the HTML5Doctor article the
dl
element was renamed to 'description list' in HTML5.
总结起来;现在 dl
不再专门适用于定义 列表,而是适用于包含术语及其相应的描述 的任何类型的列表,dfn
标签被推荐用于指示dt
的内容实际上是一个定义 术语;也就是说,一个术语的描述实际上就是它的定义(在以前的规范中曾经是必然的,但在 HTML5 中不再是这样)。
令人困惑,我知道,但这是基本思想:如果 dt
的内容是正在处理的内容,则在 dt
中使用 dfn
由其 dd
定义。
关于html - 什么时候一起使用 dfn 和 dt?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11066307/