gpt4 book ai didi

css - Z-index 绝对定位背景图

转载 作者:技术小花猫 更新时间:2023-10-29 11:35:36 27 4
gpt4 key购买 nike

我想将 Wrapper-Top 层放在另一个层之上。我设置了z-indexposition,这应该足够了。我错过了什么吗?这是 website : 提前谢谢你。

编辑:这是我使用的代码:

<body>
<div class="Wrapper-Top">
</div>
<div class="Wrapper-Middle">
hjklhjkhkjlhjkl
</div>
</body>
.Wrapper-Top {
min-width: 980px;
width: 100%;
height: 179px;
top: 0px;
left: 0px;
background:url(img/header-bg.png)
repeat-x 50% 0%;
z-index: 20;
}
.Wrapper-Middle {
min-width: 980px;
width: 100%;
height: 300px;
margin: 0 auto;
background: #eee;
top: 160px;
left: 0px;
position: absolute;
z-index: 10;
text-align: center;
}

最佳答案

缺少.Wrapper-Top 上的位置属性。

z-index on MDN

Initial value: auto

Applies to: positioned elements

Inherited: no

当它不存在时,.Wrapper-Top 中的 z-index:20 什么都不做。

关于css - Z-index 绝对定位背景图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16729792/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com