Z-index不适用于IE

时间:2014-06-17 19:28:48

标签: html css internet-explorer internet-explorer-8 z-index

以下代码在IE 11中运行正常,但是当我在IE8上测试页面时,Main_Box的底部不会与Intro DIV的顶部重叠。

如果我从" Intro"中移除背景颜色我可以在后面看到Main_Box的底部,但是我无法让它显示在前面。

我认为这可能是此页面上引用的错误...

Z-index in Internet Explorer not working

...所以试图将它包装在Absolute DIV中以重置z-index,但无济于事。

    <div style="position: relative; z-index: 3000">
<section id="intro">

    <h1>
        EXAMPLES
    </h1>

    <div class="animation-container">
        <div id="object" class="animate fadeIn"></div>
    </div>

    <div id="intro-copy">
        <img src="./images/arrow.png" alt="Arrow" id="arrow" class="pulse" />
        <p>Scroll down</p>
    </div>
</section>
</div>

使用IE11 HTML:

<section id="main">

    <div class="Main_Box">
    <h10>
        “People often represent the weakest link in the security chain”
    </h10>

    <h2>
        Contact us today to see how we can help.
    </h2>
    </div>

</section>


<section id="intro">

    <h1>
        EXAMPLES
    </h1>

    <div class="animation-container">
        <div id="object" class="animate fadeIn"></div>
    </div>

    <div id="intro-copy">
        <img src="./images/arrow.png" alt="Arrow" id="arrow" class="pulse" />
        <p>Scroll down</p>
    </div>
</section>

CSS

#main{
height: 420px;
width: 100%;
position: relative;
top: 130px;
 }

.Main_Box {
border-width: 5.547px;
border-color: rgb( 255, 255, 255 );
border-style: solid;
border-radius: 10px;
background-image: -moz-linear-gradient( 90deg, rgb(0,0,0) 0%, rgb(27,27,27) 100%);
background-image: -webkit-linear-gradient( 90deg, rgb(0,0,0) 0%, rgb(27,27,27) 100%);
background-image: -ms-linear-gradient( 90deg, rgb(0,0,0) 0%, rgb(27,27,27) 100%);
box-shadow: 2.5px 4.33px 5px 0px rgb( 0, 0, 0 );
position: relative;
width: 70%;
height: 270px;
margin: 0 auto;
position: relative;
z-index: 9999;
padding: 30px;
}


#intro{
height: 650px;
width: 100%;
position: absolute;
background-color: #ffffff;
}

非常感谢任何帮助。

这是我的Dev网站的链接:

http://goo.gl/NlAkiU

谢谢,

1 个答案:

答案 0 :(得分:0)

尝试在部分级别指定z-index; #main#intro是兄弟姐妹,因此就传统浏览器而言,更有可能与stacking context相同。

#main { z-index: 9999; }