gpt4 book ai didi

html 表格标题 rowspan 到中心标题

转载 作者:行者123 更新时间:2023-12-05 01:48:11 26 4
gpt4 key购买 nike

我有一个类似 this 的表格:

<table border="1">
<thead>
<tr>
<th colspan="2">Items</th>
<th colspan="2">Type</th>
<th colspan="4">Values</th>
<th colspan="2">Date</th>
</tr>
<tr>
<th colspan="2"></th>
<th colspan="2"></th>
<th colspan="2">Before</th>
<th colspan="2">After</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody></tbody>

在表格的标题中,我希望标题ItemsTypeDate 垂直居中。我尝试在这些 header 上使用 rowspan="2",但这没有用。有什么想法吗?

最佳答案

使用 rowspan 时,您必须不添加下一行中的列(或与 rowspan 一样多的行)数减一)。

你的 demo, updated :

<table border="1">
<thead>
<tr>
<th rowspan="2">Items</th>
<th rowspan="2">Type</th>
<th colspan="4">Values</th>
<th rowspan="2">Date</th>
</tr>
<tr>
<th colspan="2">Before</th>
<th colspan="2">After</th>
</tr>
</thead>
<tbody></tbody>
</table>

注意:如果删除 BeforeAfter colspan,您的Values colspan 可以只是 2

关于html 表格标题 rowspan 到中心标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17092388/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com