css - IE 忽略 zIndex

标签 css internet-explorer z-index

我有这个文本区域(它在单击特定按钮后展开)应该位于该文本输入字段上方。在 FF 和 Chrome 中,它正在工作。但不是在 IE(6+7) 中。有谁知道问题出在哪里以及我该如何解决?

<html>
<head>
<style type="text/css">
.Tbl { width: 100%; }
.Col1 { width: 10%; }
.Col2 { width: 90%; }

.CellTA { background-color: #00F; vertical-align: top; padding: 5px; }
.DivTA { position: relative; }
.DivTA2 { position: absolute; background-color: #FF0; padding: 5px; }
.TA { position: relative; z-Index: 10; height: 50px; width: 200px; }

.CellInp { background-color: #F0F; padding: 5px; }
.DivInp { position: relative; width: 100%; background-color: #0F0; }
.Inp { position: relative; width: 200px; }
</style>
</head>
<body>
<table class="Tbl">
  <colgroup>
    <col class="Col1" />
    <col class="Col2" />
  </colgroup>
  <tr>
    <td>Ref</td>
    <td class="CellTA">
      <div class="DivTA">
        <div class="DivTA2">
          <textarea class="TA"></textarea>
        </div>
      </div>
    </td>
  </tr>
  <tr>
    <td>eMail</td>
    <td class="CellInp">
      <div class="DivInp">
        <input type="text" class="Inp">
      </div>
    </td>
  </tr>
</table>
</body>
</html>

提前致谢

编辑:添加填充并更改 DivTA2 的背景颜色

最佳答案

IE 对待 z-index 的方式与其他浏览器略有不同。这些博客条目可能对您有所帮助:

http://annevankesteren.nl/2005/06/z-index

http://brenelz.com/blog/squish-the-internet-explorer-z-index-bug/

简而言之,我认为您可能需要向拥有它的元素的父元素添加一个 z-index。 (我不完全确定将它向上添加一级是否可行——如果这不起作用,您也可以尝试将它添加到祖父元素。)

关于css - IE 忽略 zIndex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3701402/

相关文章:

javascript - 试图从无序列表中获取最后一个元素

html - 边框图像不显示

jquery - 滑动时视差图像不会居中

html - 为什么会有这种 z-index 行为?

jquery - 使用 CSS 使图像正确定位/分层

html - 重新调整网络浏览器大小时如何防止按钮移动

flash - 为什么 IE 中的 Z-Index 不按照 Flash 电影应有的方式呈现?

javascript - 您可以在 Internet Explorer 上捕获这些单选按钮事件吗?

javascript - 如何使用 javascript (jquery) 替换列表中图像的 src?

android - AndEngine- 在其父级后面绘制 Sprite 的子级