我有这个文本区域(它在单击特定按钮后展开)应该位于该文本输入字段上方。在 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/