开发者

What's going on with z-indexing here of inputs in IE8?

开发者 https://www.devze.com 2023-02-02 11:03 出处:网络
I am trying to layer 2 inputs on top of each other in HTML. In most browsers (Safari, FF, IE7) I do this with the following code and it works fine so that the second input is placed on top of the firs

I am trying to layer 2 inputs on top of each other in HTML. In most browsers (Safari, FF, IE7) I do this with the following code and it works fine so that the second input is placed on top of the first with the lighter text color, and when you click in the area the focus goes to it. In IE8 however, the first one appears to be over the second one, so that when you click it and start typin开发者_StackOverflow中文版g you see the lighter colored text.

<!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>


The problem seems pretty similar to that one, so I think you'll have to wrap a <input> into a <div> with higher z-index.

0

精彩评论

暂无评论...
验证码 换一张
取 消