简体   繁体   English

Z索引不适用于IE

[英]Z-index not working on IE

The following code works fine in IE 11, but when I test the page on IE8 the bottom of the Main_Box does not overlap the top of the Intro DIV. 以下代码在IE 11中可以正常工作,但是当我在IE8上测试页面时,Main_Box的底部与Intro DIV的顶部不重叠。

If I remove the background colour from "Intro" I can see the bottom of the Main_Box behind it, but I cannot get it to display in front. 如果我从“简介”中删除了背景色,则可以看到它后面的Main_Box的底部,但无法使其显示在前面。

I thought it might be the bug referenced on this page... 我认为这可能是此页面上引用的错误...

Z-index in Internet Explorer not working Internet Explorer中的Z索引不起作用

...so tried to wrap it in a Absolute DIV to reset the z-index, but to no avail. ...因此尝试将其包装在绝对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>

Working IE11 HTML: 可以使用的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 的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;
}

Any help greatly appreciated. 任何帮助,不胜感激。

Here is a link to my Dev site: 这是我的开发站点的链接:

http://goo.gl/NlAkiU http://goo.gl/NlAkiU

Thanks, 谢谢,

Try assigning z-index at the section level; 尝试在部分级别分配z-index; #main and #intro are siblings, and consequently are far more likely to be in the same stacking context as far as legacy browsers are concerned. #main#intro是同级,因此就旧版浏览器而言,它们更有可能位于相同的堆栈上下文中。

#main { z-index: 9999; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM