gpt4 book ai didi

css - Z-Index 绝对定位 - 使用 Z-Index 在面板位于后面时始终显示在顶部

转载 作者:太空宇宙 更新时间:2023-11-03 19:13:26 24 4
gpt4 key购买 nike

我对 CSS 已经很习惯了,但我遇到了一个问题,想知道是否有解决方案。

如果我有一个带有相对定位和 z-index:2 的 div 和另一个带有 z-index:1 的 div。有没有办法让第二个 DIV 中的元素上升到第一个之上。 Z-index:3 不会这样做,因为它位于 z-index 2 处的元素内。

.div1 {
position:relative;
z-index:2
}
.div2 {
position:relative;
z-index:1
}
.inner element {
position:relative;
z-index:3
}

任何想法。

很棒

最佳答案

假设我正确理解了您的问题 - 不,您想要放在顶部的元素必须具有更高的 z-index。

http://jsfiddle.net/Wgsqd/

关于css - Z-Index 绝对定位 - 使用 Z-Index 在面板位于后面时始终显示在顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7569037/

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