I was inspired to ask this by a comment on my How can I style a list of name-value pairs to appear like an HTML table? question last night, that code like this is not an appropriate use of label. What should I rather use to indicate a fixed-name / changing-value pair in read only mode?
<ol class="name-value" style="width: 100%;">
<li>
<label for="about">Client</label>
<span id="about">Apartment Applied Visual Arts</span>
</li>
<li>
<label for="about">Report Date</label>
<span id="Span1">2011/08/08 16:50:10</span>
</li>
<li>
<label for="about">Report No.</label>
<span id="Span2">33251</span>
</li>
</ol>
Name-value pairs are represented by a set of text strings in which name="value" are usually separated by commas, semicolons, space or newline character.
A name–value pair, also called an attribute–value pair, key–value pair, or field–value pair, is a fundamental data representation in computing systems and applications. Designers often desire an open-ended data structure that allows for future extension without modifying existing code or data.
The key-value pair idea is used by CSS rules to set values of properties, so you can paint a particular style for HTML elements, see the next css rule which targets a elements. a { color: crimson; font-size: 1.5em; }
I use definition lists:
<dl>
<dt>Key</dt>
<dd>Value</dd>
<dt>Another key</dt>
<dd>Another value</dd>
</dl>
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