2

我有一张这样的桌子

<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>

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

4

3 回答 3

5

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

您的演示,更新

<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>

注意:如果您删除Beforeand After colspan,您Values colspan可以只是2.

于 2013-06-13T16:33:40.053 回答
0
<table border="1">
<thead>        
    <tr>
        <th colspan="2" rowspan="2">Items</th>
        <th colspan="2" rowspan="2">Type</th>
        <th colspan="4">Values</th>
        <th colspan="2" rowspan="2">Date</th>
    </tr>        
    <tr>
        <th colspan="2">Before</th>
        <th colspan="2">After</th>
    </tr>
</thead>
<tbody></tbody>
于 2013-06-13T16:34:47.140 回答
0
<table border="1">
<thead>        
    <tr>
        <th rowspan="2">Items</th>
        <th rowspan="2">Type</th>
        <th colspan="2">Values</th>
        <th rowspan="2">Date</th>
    </tr>        
    <tr>
        <th>Before</th>
        <th>After</th>
    </tr>
</thead>
<tbody></tbody>

于 2015-05-06T04:15:00.427 回答