【问题标题】:Width of a table cell that contains elements with style="display:none;"包含 style="display:none;" 元素的表格单元格的宽度
【发布时间】:2012-09-26 07:21:25
【问题描述】:

我有一个表格,其中有一列包含我用 jQuery 切换的图像。

<table>
  <tr>
    <td>
      <img class="tp" widht="24" height="23" src="1.png" />
      <img class="tp" widht="24" height="23" src="2.png" style="display:none;" />
    </td>
  </tr>
</table>

页面渲染时,表格单元格宽度加倍。

我认为当一个元素有 display:none 时,计算表格单元格的宽度时没有计算在内。

有没有简单的方法来解决这个问题?

【问题讨论】:

标签: html jquery-ui styles


【解决方案1】:

style="display: none" 不计算添加元素的高度或宽度。

宽度拼写不匹配。这可能会导致您的问题:D

【讨论】:

    【解决方案2】:

    它是 width 而不是您输入的 widht

    【讨论】:

      猜你喜欢
      • 2014-03-25
      • 2013-06-05
      • 2011-03-03
      • 2015-12-14
      • 2010-11-30
      • 1970-01-01
      • 1970-01-01
      • 2017-12-17
      • 1970-01-01
      相关资源
      最近更新 更多