[英]Why is the z-index not working in my code?
My z-index in CSS is not working.我在 CSS 中的 z-index 不工作。 My fixed header becomes invisible as soon as I scroll over another container.一旦我滚动到另一个容器,我的固定标题就会变得不可见。 Then I wanted to increase the z-index, but it doesn't work.然后我想增加z-index,但它不起作用。
I want my fixed header to no longer become invisible as soon as I scroll over a container.我希望我的固定标题不再在我滚动容器时变得不可见。 Here is my code:这是我的代码:
.header {
width: 100%;
height: 95px;
background-color: rgba(0, 0, 0, 0.813);
position: fixed;
top: 0;
z-index: 1;
z-index does NOT work on fixed-positioned items. z-index 不适用于固定位置的项目。
Alternatively, you can make a child inside the header, and set the z-index on that.或者,您可以在页眉内创建一个子项,并在其上设置 z-index。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.