【发布时间】:2011-10-18 09:26:40
【问题描述】:
我有两个绝对定位在图像顶部的锚点,链接在其他浏览器(Chrome、FF、Safari)中可点击,但在 IE 中不可点击(目前已在 8 和 9 中测试)
奇怪的是,如果我给链接一个 background-color 它们是可点击的,但是如果 background-color 设置为 transparent(这是我想要的)它们不再是可点击,我也试过设置zoom:1,但没有运气。我猜 IE 中的 hasLayout 位在 IE 8/9 中消失了,所以现在猜测 zoom 对于这类问题并不重要。
有什么想法可以让这些链接在 IE 8/9 中显示为透明背景?
这是我一直在使用的小提琴:jsFiddle example
我有以下 HTML 布局:
<div id="content">
<img src="http://placehold.it/724x300" width="724" height="300" alt="woot" />
<div id="countdown"></div>
<a id="link1" href="http://www.stackoverflow.com" title="link1"></a>
<a id="link2" href="http://www.stackoverflow.com" title="link2"></a>
</div>
和 CSS:
body {text-align:center;}
#content {position:relative; width:724px; height:300px; margin:0 auto;}
#countdown {position:absolute; width:650px; height:110px; top:100px; left:30px; background-color:blue;}
#link1 {position:absolute; width:520px; height:35px; bottom:20px; left:0;}
#link2 {position:absolute; width:200px; height:35px; bottom:20px; right:0;}
【问题讨论】:
-
您的链接是不可见的,除非您正在搜索它们。他们不会有任何文字吗?
-
我以前也遇到过这个问题,尝试使用@Michael的解决方案。这是我能够完成/绕过它的唯一方法。
-
@tw16 链接将位于图片中可点击的内容之上,链接本身没有文字(基本上是图片地图)
-
您可以将其编码为 css base64,如下所示:proger.i-forge.net/The_smallest_transparent_pixel/eBQ
标签: html css internet-explorer css-position