在制作网页时经常会用到列表,而最常用的列表是无序列表Ul和有序列表Ol。其实还有一种定义列表Dl,虽然不太常用,但是实际上确有着很强的作用域。
最新的Html5中对dl元素的解释是:
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).
从语义上讲,dl定义了一个定义列表,它包含了由dt和dd组成的group对,dt代表条目或名称,dd则表示了描述或具体的值。实际上定义列表是上述有序列表和无序列表的一个很好的补充。基本上所有用有序列表和无序列表无法充分表示的列表都能用定义列表来定义。本文主要就对定义列表的应用环境举一些实用的例子。
先看一些W3C规范中的例子:
引自:http://www.w3.org/TR/html401/struct/lists.html
1. 条目(人名)及条目的描述
1 2 3 4 5 6 7 8 9 10 11 12 | <DL>
<DT>Dweeb
<DD>young excitable person who may mature
into a <EM>Nerd</EM> or <EM>Geek</EM>
<DT>Hacker
<DD>a clever programmer
<DT>Nerd
<DD>technically bright but socially inept person
</DL> |
2. 混合的条目及描述
1 2 3 4 5 6 7 8 9 | <DL>
<DT>Center
<DT>Centre
<DD> A point equidistant from all points
on the surface of a sphere.
<DD> In some field sports, the player who
holds the middle position on the field, court,
or forward line.
</DL> |
3. Another application of DL, for example, is for marking up dialogues, with each DT naming a speaker, and each DD containing his or her words.
用作对话的呈现,dt用于表示说话的人,dd则表示该对话的内容。
+ 截一些图来具体看看dl的用处:


↑混合的定义列表实例




