[英]How to fix background-color covering the "z-index: -1" rule
With pure CSS code i generated some ribbons.使用纯 CSS 代码,我生成了一些丝带。
If u put a background-color
or background-image
to the ribbon's parent or html body, the ribbon :after
and :before
border-color
is not shown for some reason, even with a z-index: -1
.如果您将
background-color
或background-image
放在功能区的父级或 html 正文中,则功能区:after
和:before
border-color
由于某种原因不会显示,即使使用z-index: -1
。
The reason is that the background-color
of the parent is hiding it but i can't find a solution using both, background-color and ribbon :after and :before border-colors.原因是父的
background-color
隐藏了它,但我找不到同时使用背景颜色和功能区的解决方案:after 和 :before border-colors。
The demonstration: http://codepen.io/anon/pen/XXOERg演示: http : //codepen.io/anon/pen/XXOERg
With z-index: -1
you position an object behind your background <div/>
which has no stacking context.使用
z-index: -1
将一个对象放置在背景<div/>
后面,该对象没有堆叠上下文。 Give it a z-index
and it will work:给它一个
z-index
,它会起作用:
<div class="col-md-6" style="background-color:blue;z-index:0">
<!-- ... -->
</div>
Here is a codepen fork这是一个代码笔叉
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.