使用Internet Explorer显示z-index的问题

时间:2010-11-03 09:10:49

标签: html css internet-explorer firefox

我正在制作一个网站,我在浏览IE时遇到了麻烦。其他所有浏览器都没问题。在一些关于z-index的google搜索之后,很多人都提到了IE的错误,主要是修复似乎是从0 - 1000 - 2000上升。经过几个小时的搜索,我仍然感到困惑。谈到这种事情,我有点像菜鸟。任何帮助或建议将不胜感激。这是我的代码:

        #bg_mask {
            position: absolute;
            background-color:#000000;
            background-repeat:no-repeat;
            background-attachment:inherit;
            background-position:center;
            z-index: 10;
            visibility: hidden;
        } 

        #frontlayer {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 31.8em;
            padding : 30px;
            width: 20em;
            height: 23.4em;
            background-color: #000000;
            visibility: visible;
            border: 0px solid black;
            z-index: 30;
        } 

        #toplayer {

            visibility: visible;
            z-index: 2;
        }

        div.scroll{
            overflow:auto;
            filter:alpha(opacity=0.85);
            -moz-opacity:0.85;
            -khtml-opacity:0.85;
            opacity: 0.85;
        }

在大多数浏览器(chrome和firefox)中,我在背景图片上方有一个稍微透明的叠加层,我在上面的代码中使用了它。然而,对于IE,我什么都看不见。

注意:我已尝试过所有版本的IE。

谢谢:)

1 个答案:

答案 0 :(得分:-2)

在html标记中包含正确的DOCTYPE。这可能有用:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"