表td colspan不适用于带ID的tr [英] Table td colspan not working for tr with ids
问题描述
我的表格结构类似于以下内容:
I have a table structure similar to below:
<tr>
<td colspan="5">
TEST
</td>
</tr>
<tr id="abcd_<?php echo $id; ?>" style="display: none;">
<td colspan="5">
<span id="hidtb_<?php echo $id; ?>"></span>
</td>
</tr>
该表在循环内,并且$id
的值更改.使用JavaScript将第二个tr
设置为display : block
.但是<td colspan="5">
并没有涵盖全部五个<td>
,而是仅覆盖了一个.
The table is within a loop and the value of $id
changes. The second tr
is set to display : block
using javascript. But the <td colspan="5">
is not covering all the five <td>
s, instead only one.
为什么我的colspan
无法正常工作?
Why my colspan
is not working?
推荐答案
这是display: block
的问题.
请参考以下链接 http://thedesignspace.net/MT2archives/000376.html#.UUrg3FfCd1u
如果要隐藏tr
,请使用display: table-row
而不是display: block
来显示该tr
.
If you are hiding tr
, then use display: table-row
instead of display: block
to display that tr
.
如果要隐藏td
,请使用display: table-cell
而不是display: block
来显示该td
.
If you are hiding td
, then use display: table-cell
instead of display: block
to display that td
.
设置tr
的样式时,请使用table-row
,而不使用block
.完美!
Use table-row
, no block
when styling a tr
. Perfect!
这篇关于表td colspan不适用于带ID的tr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!