gpt4 book ai didi

html - 为什么我不能将这个 放在下面的 div 上?

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

我在定位方面遇到了问题。有一个容器 div,其中包含另一个 div 和一个标签(两者都是单独的)我需要一个标签来覆盖第二个 div,但是当我使用 z-index 时它似乎不起作用:

这是jsFiddle

http://jsfiddle.net/7YQhu/

和代码

.container{
width: 100%;
background: yellow;
opacity: 0.4;
height: 130px;
position:absolute;
}

.inner {
position: absolute;
background: red;
opacity: 0.5;
height: 100px;
width: 100%;
margin: 15px 0;
}

.inner-link {
margin:15px auto;
background:blue;
display:block;
width:100px;
height: 100px;

z-index: 99!important;
}

最佳答案

<a> 创建一个堆叠上下文通过给它一个位置值而不是默认值,static

.inner-link {
position: relative;
}

http://jsfiddle.net/Adrift/7YQhu/1/

关于html - 为什么我不能将这个 <a> 放在下面的 div 上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16443141/

24 4 0
文章推荐: c# - 有没有一种方法可以在应用程序立即启动时执行 ExecuteEvery5Min 方法,然后每 5 分钟通过计时器执行一次?
文章推荐: c# - 在 C# 中使用 Lambda 表达式是否有任何性能提升?
文章推荐: c# - RX : How to bind an IObservable to a property (ReactiveUI)