In what scenarios we should go for <dl>
not <ul>
?
在什么情况下我们应该去
-
而不是
-
?
Does it matter for screen reader user <ul>
or <dl>
? does screen reader software notify user about content is in <ul>
or <dl>
?
屏幕阅读器用户
-
或
-
是否重要?屏幕阅读器软件通知用户有关内容是在
-
还是
-
?
3 个解决方案
#1
26
A <dl>
is a definition list. It should be used in such a case as, perhaps, a dictionary:
-
是定义列表。它应该用在这样的情况下,也许是字典:
Use-case:
用例:
<dl>
<dt>Thesaurus</dt>
<dd>A book for finding synonyms of other words, often alphabetical. Similar to a dictionary.</dd>
</dl>
Result of the above:
结果如下:
- Thesaurus
- A book for finding synonyms of other words, often alphabetical. Similar to a dictionary.
The idea being that the term-to-be-defined is held in the
<dt>
element, and the definition of that term is given in the
<dd>
.
A <ul>
is an unordered list. Now, a <dl>
does not imply any order to its contents, but it does imply a semantic relation between its children. A <ul>
, however, could contain anything that is not ordered.
-
是无序列表。现在,
-
并不意味着对其内容的任何顺序,但它确实意味着它的子代之间的语义关系。但是,
-
可能包含任何未订购的内容。
#2
2
When you're working with a set of definitions and not merely an list of unordered items.
当您使用一组定义而不仅仅是一个无序项列表时。
#3
0
For ambiguous cases like your examples in the comment on Jonathan's answer (person name then description, question then answer), why don't you install a trial version of a screen reader or two and find out which construct is read most appropriately?
对于像Jonathan的答案(人名然后描述,问题然后答案)的评论中的例子那样的模糊情况,为什么不安装一两个屏幕阅读器的试用版并找出哪个结构最合适?
Here are two (from here):
这是两个(从这里):
- JAWS
- 颚
- Window Eyes
- 窗眼
#1
26
A <dl>
is a definition list. It should be used in such a case as, perhaps, a dictionary:
-
是定义列表。它应该用在这样的情况下,也许是字典:
Use-case:
用例:
<dl>
<dt>Thesaurus</dt>
<dd>A book for finding synonyms of other words, often alphabetical. Similar to a dictionary.</dd>
</dl>
Result of the above:
结果如下:
- Thesaurus
- A book for finding synonyms of other words, often alphabetical. Similar to a dictionary.
The idea being that the term-to-be-defined is held in the
<dt>
element, and the definition of that term is given in the
<dd>
.
A <ul>
is an unordered list. Now, a <dl>
does not imply any order to its contents, but it does imply a semantic relation between its children. A <ul>
, however, could contain anything that is not ordered.
-
是无序列表。现在,
-
并不意味着对其内容的任何顺序,但它确实意味着它的子代之间的语义关系。但是,
-
可能包含任何未订购的内容。
#2
2
When you're working with a set of definitions and not merely an list of unordered items.
当您使用一组定义而不仅仅是一个无序项列表时。
#3
0
For ambiguous cases like your examples in the comment on Jonathan's answer (person name then description, question then answer), why don't you install a trial version of a screen reader or two and find out which construct is read most appropriately?
对于像Jonathan的答案(人名然后描述,问题然后答案)的评论中的例子那样的模糊情况,为什么不安装一两个屏幕阅读器的试用版并找出哪个结构最合适?
Here are two (from here):
这是两个(从这里):
- JAWS
- 颚
- Window Eyes
- 窗眼