Thanks for this interesting question. There are a few more things here.
What is a couple? Two elements together. Therefore, for this we need a tag. Let's say this is a pair tag.
<pair></pair>
The pair contains the key and the corresponding value:
<pair><key>keyname</key><value>value</value></pair>
Then we need to specify the pairs:
<pairlist> <pair><key>keyname</key><value>value</value></pair> <pair><key>keyname</key><value>value</value></pair> </pairlist>
The next thing to consider is the mapping of pairs. The usual layout is tabular:
key value key value
and an optional separator, which usually has a colon:
key : value key : value
Colons can be easily added via CSS, but this will certainly not work in IE.
The case described above is ideal. But there is no valid HTML markup to fit in easily.
Summarizing:
dl is semantically close, for simple cases of key and value, but it is difficult to apply visual styles (for example, to display inline pairs or add a red border only to a pair with a pair). The most suitable for dl is the glossary. But this is not the case that we are discussing.
The only alternative I see in this case is to use table , for example:
<table summary="This are the key and value pairs"> <caption>Some notes about semantics</caption> <thead class="aural if not needed"> <tr><th scope="col">keys</th><th scope="col">values</th></tr> </thead> <tbody class="group1"> <tr><th scope="row">key1</th><td>value1</td></tr> <tr><th scope="row">key2</th><td>value2</td></tr> </tbody> <tbody class="group2"> <tr><th scope="row">key3</th><td>value3</td></tr> <tr><th scope="row">key4</th><td>value4</td></tr> </tbody> </table>
Another:
<ul> <li><strong>key</strong> value</li> <li><strong>key</strong> value</li> </ul>
or
<ul> <li><b>key</b> value</li> <li><b>key</b> value</li> </ul>
or, if keys can be associated:
<ul> <li><a href="/key1">key1</a> value</li> <li><a href="/key2">key1</a> value</li> </ul>
A pair of keys and values is usually stored in a database, and they usually store tabular data, so the table will match the best IMHO.
What do you think?