链接在重叠的 Div 中不起作用

发布于 2024-11-19 02:45:51 字数 951 浏览 5 评论 0原文

在为网站制作页脚时,我偶然发现了重叠 Div 的一些奇怪行为。 位置查看示例:

http://mike.latysheva.ru/test.html

您可以在以下 问题是第二个链接在 IE7 和至少某些版本的 IE8 中不可点击。在 IE9 和 Firefox 中运行良好。

这是代码,它非常简单(您可以在页面源代码中看到完整的代码):

<div style="height: 120px; width: 200px; background: #DDDDDD; postion:relative;">
  <div style="height: 40px; padding: 10px;postion:relative;">
    <a ...[have to remove an actual link in order to post it here]>Test Link 1</a>
  </div>
  <div style="height: 40px; padding: 10px;postion:relative;">
     <a ...[have to remove an actual link in order to post it here]">Test Link 2</a>
  </div>
</div>
<div style="width:250px;height:100px; background:#777777;margin-top:-60px;position:relative;z-index: -10;"></div>

代码可能有什么问题?它与 z-index: -10 有关系吗?我完全困惑了......请帮忙......

提前谢谢你!

Making a footer for a web site I stumbled upon some strange behavior of overlapping Divs. You can see an example at:

http://mike.latysheva.ru/test.html

The issue is that second link is not clickable in IE7 and at least some versions of IE8. Works fine in IE9 and Firefox.

Here is the code, it is pretty simple (you can see full code in page source):

<div style="height: 120px; width: 200px; background: #DDDDDD; postion:relative;">
  <div style="height: 40px; padding: 10px;postion:relative;">
    <a ...[have to remove an actual link in order to post it here]>Test Link 1</a>
  </div>
  <div style="height: 40px; padding: 10px;postion:relative;">
     <a ...[have to remove an actual link in order to post it here]">Test Link 2</a>
  </div>
</div>
<div style="width:250px;height:100px; background:#777777;margin-top:-60px;position:relative;z-index: -10;"></div>

What can be wrong with the code? Does it have something to do with z-index: -10? I'm totally confused ... Please help ...

Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

白芷 2024-11-26 02:45:51

尝试为 z-index:-10 div 的父级指定 z-index:1。

Try giving the parent of the z-index:-10 div a z-index:1.

回忆那么伤 2024-11-26 02:45:51

难道你的前两个 div 被赋予了 postion 而不是 position 属性? z-index 需要非静态定位的 div 才能正常工作。

Could it be that your first two divs are given postion instead of position attributes? z-index needs non-static positioned divs to work right.

陌伤ぢ 2024-11-26 02:45:51

这与 div 的顺序有关。此外,如果您将链接放在另一个包含多个 div 的 div 上,则覆盖层需要背景。我通常使用透明png。否则浏览器可以看穿它(ie7等)。

问题解决:
http://jsfiddle.net/Anytech/Gr3ae/1/

It has to do with the order of the divs. Also if you are putting a link over another div which contains multiple divs, the overlay needs a backround. I usually use a transparent png. Otherwise the browser can see through it (ie7 etc).

Solution to problem:
http://jsfiddle.net/Anytech/Gr3ae/1/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文