当div表格中的div具有可见性时,如何将Html表格行默认设置为无高度:无 [英] How can I get Html table row to default to no height when div within it has visibility:none
问题描述
麻烦是即使div被隐藏,行占据了垂直高度,我认为这是高度,但我该如何解决这个问题。或者另一个想法可以让隐藏或我可以只为div做。
< table>
< tr>
< td>第1列< / td>
< td>第2栏< / td>
< / tr>
< tr>
< td colspan =2>
< div id =1style =display:none>
< / div>
< / td>
< / tr>
< tr>
< td>第1列< / td>
< td>第2栏< / td>
< / tr>
< / table>
我已经完成了:
http://jsfiddle.net/ijabz/zz5zo2jh/
如果您移除隐藏的行,则其他行之间的垂直间距会减少
解决方案将样式应用到您的表格行,不是你的div:
< table>
< tr>
< td>第1列< / td>
< td>第2栏< / td>
< / tr>
< tr style =display:none>
< td colspan =2>
< div id =1>
< / div>
< / td>
< / tr>
< tr>
< td>第1列< / td>
< td>第2栏< / td>
< / tr>
< / table>
In html I'm using a to display a numbers of rows, then between each row is another row containing a single , that in turn contains a with style:none. This row contains additional information for the row above and in the ful code and can be toggled to display or not by clicking on a button on the album row.
The trouble is that even when the div is hidden the row takes up vertical height, I assume this is the height of the , but how can I fix this. Or another thought can I make the hidden or can I only do that for divs.
<table>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
<tr>
<td colspan="2">
<div id="1" style="display:none">
</div>
</td>
</tr>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
</table>
Ive done a:
http://jsfiddle.net/ijabz/zz5zo2jh/
if you remove the hidden rows there is less of a vertical gap between the other rows
apply the style to your table row, not your div:
<table>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
<tr style="display:none">
<td colspan="2">
<div id="1">
</div>
</td>
</tr>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
</table>
这篇关于当div表格中的div具有可见性时,如何将Html表格行默认设置为无高度:无的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!