html - 额外的隐藏表单输入,导致表格单元格在 IE7 上展开(截图)

标签 html css internet-explorer cross-browser internet-explorer-7

这是我见过的最奇怪的事情之一, 我在表格单元格内有一个表格,其中包含隐藏的输入。 我注意到在 IE7 中,一旦有超过 1 个隐藏输入,单元格就会展开。

这是一个截图(说了三个也说了两个):

enter image description here

这是 HTML:

<table border="1" class="fix">
    <col style="width:150px;" />
    <col style="width:200px;" />
    <col style="width:200px;" />
    <col style="width:200px;" />
    <col style="width:190px;" />
      <tr>
        <td class="cell"></td>
        <td class="cell"></td>
        <td class="cell"><form action="a.php" method="GET">
          <input name="a" type="hidden" value="1"/>
          <input name="b" type="hidden" value="2"/>
          <div class="button-zone"><input type="submit" class="button" value="ABCDEF GEHIJKLM"></div></form></td>
        <td class="cell"></td>
        <td class="cell"></td>
      </tr>
</table>

一旦我删除了输入 b 行(我需要的),单元格看起来就正常了。

这是 CSS:

table.fix {
     table-layout: fixed;
}

table.fix td { 
overflow: hidden;
}

td {
    padding: .31em 1em 2em 1em;
    text-align: left;
}

.cell {
    background-color: gray;
    padding-bottom: 12px;
    padding-left: .44em;
}

.button-zone {
    float: left;
    margin-left: 0px;
    position: relative;
}

.button {
    background-color: yellow;
    font-family: Arial;
    font-weight: bold;
    color: black;
    border: 0;
    overflow: visible;
    font-size: 16px;
    padding: 4px 20px 4px 8px;
}

这发生在 IE7 上,有什么方法可以在不修改大小的情况下解决这个问题?

最佳答案

你可以这样设置CSS:

input[type="hidden"]{
    height:0;
}

关于html - 额外的隐藏表单输入,导致表格单元格在 IE7 上展开(截图),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22888336/

相关文章:

css - Markdown 的样式脚注

c# - 开发者工具 (F12) Internet Explorer 空控制台,但 Firefox 不支持

javascript - 向链接添加延迟

html - 有什么方法可以向嵌入式 SVG 添加类?

javascript - 制作圆周运动选择菜单

(未知源位置)第 5 行第 9 列的 JavaScript 严重错误

javascript - 避免 IE 中的 "Stop Script?"对话框

javascript - 如何将图像上传到 HTML5 canvas

javascript - 如果输入类型文件不是图像,则使用 jquery 脚本显示警报

css - CSS 动画在不可见时仍然会发生吗?