Semantic implications of multiple <dd> tags

偶尔善良 提交于 2019-12-01 04:42:51

The document that you link to contains the following example:

In the following example, one entry ("Authors") is linked to two values ("John" and "Luke").

<dl>
 <dt> Authors
 <dd> John
 <dd> Luke
 <dt> Editor
 <dd> Frank
</dl>

In other words, the two <dd> elements following a single <dt> element are both associated to that same <dt> element.

There doesn't appear to be much of a difference in terms of semantics, then, between having multiple successive <dd> elements, and having a single <dd> that in turn contains a <ul>. If it's important to distinguish "a list" (a <ul> in a single <dd>) from "a group of values" (multiple <dd>s in sequence), then I would decide based on that. If that's not important, then given a choice I would pick multiple <dd>s in sequence, because it is simpler.

unor

The relevant part of the dl definition is:

The values within a group are alternatives; multiple paragraphs forming part of the same value must all be given within the same dd element.

I think a clear example would be a dl describing homonyms, e.g. "bank":

<dl>
  <dt><dfn>bank</dfn></dt>
  <dd>An institution where one can place and borrow money and take care of financial affairs.</dd>
  <dd>An edge of river, lake, or other watercourse.</dd>
  <dd>A row or panel of items stored or grouped together.</dd>
</dl>

↑ Here the term "bank" (dt) has three meanings (dd). Using one dd with a ul wouldn’t hold the same semantics:

<dl>
  <dt><dfn>bank</dfn></dt>
  <dd>
    <ul>
      <li>An institution where one can place and borrow money and take care of financial affairs.</li>
      <li>An edge of river, lake, or other watercourse.</li>
      <li>A row or panel of items stored or grouped together.</li>
    </ul>
  </dd>
</dl>

↑ Here the term "bank" would have only one meaning (and this meaning consists of or is described by a ul).

Coming back to your author example, you’d typically want to use the first variant (as described by BoltClock), because each author really is a "value" (dd) in the group of authors.

However, in the end it depends on your content and, more importantly, on your understanding of that content.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!