这让我头疼。我在IE(6/7)中遇到了下面的代码问题。
页面上有许多相对定位的容器项。其中一个内部项目是绝对定位的。这个内部项目应该出现在任何容器项之上。在Safari和Firefox中,这样做是正确的,但在IE中不行。
我为您提供了一个非常简化的示例。我不能删除容器上的position: relative;或内部项目上的position: absolute;,因为这最终将成为一个HTML下拉项。
非常感谢您的帮助。
预览请点击此处。
页面上有许多相对定位的容器项。其中一个内部项目是绝对定位的。这个内部项目应该出现在任何容器项之上。在Safari和Firefox中,这样做是正确的,但在IE中不行。
我为您提供了一个非常简化的示例。我不能删除容器上的position: relative;或内部项目上的position: absolute;,因为这最终将成为一个HTML下拉项。
非常感谢您的帮助。
预览请点击此处。
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
<link href="http://www.louiswalch.com/common/css/reset.css" type="text/css" rel="stylesheet">
<style type="text/css">
BODY { padding: 20px; }
.item {
margin-bottom: 5px;
padding: 5px;
background-color: orange;
position: relative;
float: left;
width: 300px;
}
.item .display {
background-color: red;
}
.item .inside {
padding: 5px;
background-color: yellow;
position: absolute;
top: 23px;
left: 10px;
width: 100%;
z-index: 5000;
}
.clear { clear: both; }
</style>
</head>
<body>
<div class="item">
<div class="display">Item</div>
</div>
<div class="clear"></div>
<div class="item">
<div class="display">Item (Open)</div>
<div class="inside">This is inside<br/>more<br/>more</div>
</div>
<div class="clear"></div>
<div class="item">
<div class="display">Item</div>
</div>
</body>
</html>