When using <dl>
lists to associate keys to values, is there a semantic difference between these 2 samples? Which one provides better semantics? What do multiple <dd>
tags imply in this context?
Sample 1: Multiple <dd>
items.
<dl>
<dt>Authors</dt>
<dd>John Lennon</dd>
<dd>Paul McCartney</dd>
<dt>Genres</dt>
<dd>Pop</dd>
<dd>Rock</dd>
</dl>
Fangs output:
Definition list of two items Authors equals John Lennon equals Paul McCartney Genres equals Pop equals Rock List end
Sample 2: Single <dd>
contains <ul>
<dl>
<dt>Authors</dt>
<dd>
<ul>
<li>John Lennon</li>
<li>Paul McCartney</li>
</ul>
</dd>
<dt>Genres</dt>
<dd>
<ul>
<li>Pop</li>
<li>Rock</li>
</ul>
</dd>
</dl>
Fangs output:
Definition list of two items Authors equals List of two items bullet John Lennon bullet Paul McCartney List end Genres equals List of two items bullet Pop bullet Rock List end List end
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With