一个页面头部 底部 中间 都有不同的背景,把他们的z-index值设为0,让他们不要挡住页面的内容。
.responsive-bg{
background: url(../images/bg-center.png) repeat-y;
position: relative;
height: 100%;
z-index: 0;
padding-bottom: 249px;
width: 100%;
}
.responsive-bg:before {
content: "";
height: 79px;
width: 100%;
position: absolute;
left: 0;
top: 0;
background: url(../images/bg-top.png) no-repeat;
z-index: 0;
}
.responsive-bg:after {
content: "";
position: absolute;
height: 342px;
background: url(../images/bg-car.png) no-repeat;
z-index: 0;
bottom: 0;
left: 0;
width: 100%;
}
wrap-tab中的元素还是被z-index为0的元素给挡住了,难道z-index为0 比 普通元素的堆叠顺序高?
如果我把.responsive-bg的relative的z-index设置成-1,就无法显示了?
我该如何让设置的背景不挡住元素?
可以通过修改wrap-tab的层叠上下文实现,demo是修改wrap-tab的position来实现
https://jsfiddle.net/ycloud/2...
下面文章介绍了多种修改层叠上下文的方式
http://www.zhangxinxu.com/wor...