我试图将我的子元素发送到堆栈层的底部,但是在输出中它将位于顶部,而不是加载代码
https://jsfiddle.net/6qop5vtL/1/
这是我的密码

.loadermask {
    position:absolute;
    z-index: 900;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    background:rgba(0,0,0,0.4);
}

.se-pre-con {
    position: fixed;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background:url(https://transfast.com/Projects/Transfast.UI/img/loadingimg.gif) center no-repeat;
}

最佳答案

将HTML更改为:

<div class="se-pre-con">
</div>
<div class="loadermask">
</div>

loadermaskse-pre-con的子级时,它的z-索引不是相对于整个DOM的,而是相对于父级中的相邻子级的。
换句话说,子级的z-index只是它在父级中的z-index,不能在父级之上或之下,因为它在父级中。

10-07 19:59
查看更多