What is an appropriate HTML pattern for displaying

2019-06-24 07:41发布

问题:

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>

回答1:

I use definition lists:

<dl>
    <dt>Key</dt>
    <dd>Value</dd>
    <dt>Another key</dt>
    <dd>Another value</dd>
</dl>