【发布时间】:2016-12-05 19:41:04
【问题描述】:
我正在尝试创建一个弹出窗口,但我遇到了 z-index 和位置问题。
.filterBar如下:
.filterBar{
position: fixed;
z-index: 3;
left: 275px;
right: 15px;
display: flex;
align-items: center;
height: 40px;
background-color: #f9f9f9;
}
outter(需要全身)如下:
#outter{
z-index: 99999999;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
width: 100%;
height: 100%;
background: rgba(22, 23, 23, 0.8);
}
有了这个样式,我得到了下一个:
因此,过滤栏在outter div之前,不管outter有更大的z-index。
如果我从 .filterBar 类中删除 z-index: 3,那么一切正常。
但我无法删除 z-index,因为我需要它来设置页面其余部分的样式。
【问题讨论】:
-
请也发布您的 html 或提供带有正确代码的小提琴链接。谢谢