所以我的问题是,我希望能够点击 .row
因为它的宽度填满了窗口而不是 .fourcol
因为它包含链接和图像等内容。 CSS 中缺少什么吗?或者我可以用 jquery 实现吗?
我的 CSS 和 HTML 是这样的:
<div class="container >
<div class="row">
<div class="fourcol>
<p>Content</p>
</div>
</div>
</div>
那我下面还有东西
<div class="drag">
<img src="image.png"/>
</div>
使用 CSS:
.row {
width: 100%;
max-width: 1240px;
min-width: 755px;
overflow: hidden;
z-index: 1;
}
.fourcol {
z-index: 3;
}
然后我定位.drag
与 position: absolute;
和 z-index: 2;
就在<p>content</p>
附近
非常感谢。
最佳答案
z-index 只有在有 position 属性时才有效。所以 .row
的 z-index 什么都不做。您至少需要添加 position: relative;
。然后在具有更高 z-index 的 .fourcol
div 中添加 .drag
div,应该会导致它出现。尽管您可能需要使用大于 2 的值。
关于jquery - css z-index 指针事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9288775/