我正在尝试在 HTML 中将第 2 层输入层叠在一起。在大多数浏览器(Safari、FF、IE7)中,我使用以下代码执行此操作,它工作正常,因此第二个输入以较浅的文本颜色放置在第一个输入的顶部,当您单击该区域时,焦点将转到它。然而,在 IE8 中,第一个似乎在第二个之上,因此当您单击它并开始键入时,您会看到颜色较浅的文本。
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<style type="text/css" media="screen">
input {
background-color: transparent;
}
</style>
</head>
<body>
<input style="position:absolute;z-index: 1;color: #dedede;">
<input type="text" style="position:relative;z-index: 3;">
</body>
</html>
最佳答案
问题似乎与 that one 非常相似,所以我认为你必须包装一个 <input>
进入<div>
具有更高的 z-index。
关于html - IE8 中输入的 z 索引是怎么回事?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4611052/