我想在部分透明的图片上方显示文本链接,而图片又位于纯色背景之上。我希望在打印页面时可以打印链接文本和图片,但不包括背景颜色。(因此我没有使用background-image属性)
问题是,尽管链接出现在图像的顶部,并且图像按预期出现在背景上方,但链接无法被点击。如果链接出现在顶部,则应该对鼠标事件敏感,但实际情况并非如此......
这在至少以下浏览器中发生:Firefox 6.0(Windows + Linux)、Firefox 3.6(Windows)和Internet Explorer 7。
请问这个问题是我的HTML/CSS问题还是浏览器问题?
以下是一些HTML代码用于演示该问题:
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div style="position: relative;z-index: -2; background-color:#333; height:200px;">
<img style="position: absolute;top: 0;left: 0;z-index: -1;" src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png" alt="Dice" />
<a style="padding:50px; color:#fff;z-index:0;" href="#">Can you click me?</a>
</div>
</body>
</html>
祝福!
Alex