表格布局:有一行获得所有空间(因为rowspan) [英] Table-Layout: have one row get all space required (because of rowspan)
问题描述
我有一些复杂的数据表,我面临着他们布局的问题:有一个单元格,获得跨所有其他行的行跨,但该单元格的内容是高度可变,可能超过所有空间其他行。
I havea few complex data-table and am facing a problem with they layout: there is one cell wich gets a rowspan across all other rows, but the content of that cell is variable in height and may well exceed space required by all other rows.
如下:
<table>
<tr><td style="height: 20px;">bla1</td><td rowspan="3">supa-col!</td></tr>
<tr><td style="height: 20px;">bla2</td></tr>
<tr><td style="height: 20px;">bla3</td></tr>
</table>
现在,让我们再看看那个带有更大supa-col的表:
Now, lets look at that table again with a larger "supa-col":
<table>
<tr><td style="height: 20px;">bla1</td><td rowspan="3" style="height: 200px;">supa-col!</td></tr>
<tr><td style="height: 20px;">bla2</td></tr>
<tr><td style="height: 20px;">bla3</td></tr>
</table>
当呈现的时候会发生什么是需要额外的vspace来包含rowspaning调用, 所有单元格的高度。
What happens when this is rendered is that the additional vspace required to include the rowspaning call gets distributed equally across the height of all cells.
我最喜欢的是在最后一行的底部附加空格,在行1和行2之间不改变。换句话说:该supa-col的大小不应该影响所有其他调用的布局...
(我也很乐意附加最后一行,可以得到所有的vetical填充需要...)
What I would prefer is that space to be appended at the bottom of the last row, so that the distance between row 1 and 2 does not change. In other words: the size of that supa-col should not have an impact on the layout of all other calls... (I'd also be happy to append a final row which could get all the vetical filling that is needed...)
(当然,在现实世界中,我不知道(或设置)高度...) / em>
(Of course, in the real world, I do not know (or set) the heights in advance...)
推荐答案
只需从最后一个属性中删除height属性...
Just remove the height attribute from the last one...
<tr><td>bla3</td></tr>
这篇关于表格布局:有一行获得所有空间(因为rowspan)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!