【问题标题】:<th> for column headers<th> 用于列标题
【发布时间】:2011-10-08 08:42:30
【问题描述】:

使用&lt;th&gt; 标记作为列标题是否合适/语义。 IE。 PriceQty 应该在 &lt;th&gt; 这样的表格的标签中吗?

+-------+--------+---------+--------+
|       | apples | oranges | lemons |
|-------+--------+---------+--------|
| Price | 100    | 200     | 300    |
|-------+--------+---------+--------|
| Qty   | 10     | 10      | 10     |
+-------+--------+---------+--------+

【问题讨论】:

标签: html semantics


【解决方案1】:

为列标题使用标签是否合适/语义。

是的

即价格和数量应该在这样的表格的标签中吗?

这些是行标题,但仍然是。

<table>
    <tbody>
        <tr>
            <td>
            <td scope="col">apples <!-- both heading and data so use td with scope -->
        <!-- etc etc -->
            <th scope="row">Price

【讨论】:

  • 酷,谢谢,也感谢范围属性,不知道。是的,我的意思是 row 标题
【解决方案2】:

是的,你可以这样做

<TABLE border="1">
<CAPTION><EM>A test table with merged cells</EM></CAPTION>
<TR><TH rowspan="2"><TH colspan="2">Average
    <TH rowspan="2">Red<BR>eyes
<TR><TH>height<TH>weight
<TR><TH>Males<TD>1.9<TD>0.003<TD>40%
<TR><TH>Females<TD>1.7<TD>0.002<TD>43%
</TABLE>

并查看链接http://www.w3.org/TR/html4/struct/tables.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-16
    • 2015-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-12
    相关资源
    最近更新 更多