问题是,是否有一种有效的(逻辑)方法可以在HTML中构建一个在列标题上方有一个总行的表。所以基本上它会是这样的:
Date | [Total number of dogs] | [Total number of cats] | [Total number of snakes]
Dogs | Cats | Snakes
[Date1] | [DogsThatDay | [CatsThatDay] | [SnakesThatDay]
等等......
通常,狗猫蛇会进入thead,但我希望总数高于。
将我的总数放入thead然后将列标题放入实际的tbody中只是另一行似乎不正确。还有另一种方法吗?
答案 0 :(得分:1)
您可以在“thead”标记中添加多行:
<thead>
<tr>
<th>Date</th>
<th>[Total number of dogs]</th>
<th>[Total number of cats]</th>
<th>[Total number of snakes]</th>
</tr>
<tr>
<th>[Date1]</th>
<th>Dogs</th>
<th>Cats</th>
<th>Snakes</th>
</tr>
</thead>
<tbody>
<tr>
...content
</tr>
</tbody>
加载表后,使用js将计数加载到标题列中。