gpt4 book ai didi

css - 绝对 div 和 z-index

转载 作者:太空宇宙 更新时间:2023-11-04 05:09:11 25 4
gpt4 key购买 nike

我有一个带有默认 position 参数的 div。现在我需要在它下面放另一个 div: enter image description here

#Dark
{
width: 250px;
height: 100px;
background-color: #1a1a1a;
margin: 0 auto;
/*position: absolute;*/
z-index: 999;
}

#Blue
{
background-color: #046a81;
height: 90px;
width: 30px;
position: absolute;
z-index: 10;
}

如果我不能使 Dark 位置成为绝对位置,如何将蓝色向下一层(它应该在 dark div 之前呈现)?

最佳答案

使 #Dark 具有 position:relative。它仍然表现得像在流中一样,但现在您可以调整 z-index

关于css - 绝对 div 和 z-index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9711057/

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