<h1>Hello Plunker!</h1>
<h2>Above the overlay</h2>
<div class="overlay"></div>
.overlay {
position:absolute;
top:0;
bottom:0;
right:0;
left:0;
background-color: rgba(34, 34, 34, 0.8);
z-index:100;
}
h2 {
z-index:200;
}
将元素的位置从更改static
为relative
/ absolute
/ fixed
。position: static
(默认)不允许z-index
(demo):
h2 {
position: relative;
z-index:200;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句