表td colspan不适用于带ID的tr [英] Table td colspan not working for tr with ids

查看:69
本文介绍了表td colspan不适用于带ID的tr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表格结构类似于以下内容:

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆