Semantically, what's the difference between

<dl>
    <dt>Term 1</dt>
    <dd>Description 1a</dd>
    <dt>Term 2</dt>
    <dd>Description 2a</dd>
    <dd>Description 2b</dd>
    <dd>Description 2c</dd>
</dl>

and

<dl>
    <dt>Term 1</dt>
    <dd>Description 1a<dd>
    <dt>Term 2</dt>
    <dd>
        <ul>
            <li>Description 2a</li>
            <li>Description 2b</li>
            <li>Description 2c</li>
        </ul>
    </dd>
</dl>

?

有帮助吗?

解决方案

The HTML5 Draft says that a dl contains "name-value" groups (a.k.a. term-description groups), with each group containing at least 1 term and at least 1 description.

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

In the first block, Term 2 can be described as either Description 2a, Description 2b, or Description 2c. There are three alternative descriptions for Term 2. An example would be different definitions of the same word (called a homonym).

In the second block, Term 2 must be described using exactly one description: a (unordered) list that contains all three of Description 2a, Description 2b, and Description 2c. For example, a list of ingredients needed for a given recipe (where the dt element represents the recipe name).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top