一个表格可以有多个表头吗?我的意思是,根据 w3c 标准,在 html(4/5) 或 xhtml 中它是否合法。
最佳答案
表头由标签<thead>
表示.标签<th>
是一个header cell,所以不清楚你的意思,因为在你的例子中你只使用了<th>
放置在 body 部分的元素。
智慧的最终来源是HTML5 specification ,它说:
[Content of the
<table>
element is:] optionally a caption element, followed by zero or more colgroup elements, followed optionally by a thead element, [...]
the HTML4 specification中也有同样的说法, 因此,一张表可能只有一个表头。
另一方面,页眉单元格 元素 ( <th>
) 可以放置在表格的任何部分 - 页眉、页脚或正文中。 (同样适用于数据单元 - <td>
)
A <th>
在正文部分表示行标题或列标题或其他标题,具体取决于"scope" attribute或上下文。
关于html - 多个表头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7304918/