[英]Why can't I make clickable links for my HTML code?
I want to make an image for my code a link so that people can click it, but whenever I upload the code to my file, I can never click it. 我想为我的代码创建一个图像链接,以便人们可以单击它,但是无论何时将代码上传到我的文件中,我都永远无法单击它。 Can someone please help? 有人可以帮忙吗? Here is my code: 这是我的代码:
<!DOCTYPE html>
<html>
<head>
<style>
img.transp {
opacity: 0.4;
filter: alpha(opacity=40);
}
</style>
<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<title>
Home - Stampycraft.net
</title>
</head>
<body>
<center>
<h1>
<a href="http://facebook.com"><img src="gaoosh.gif" /></a>
</h1>
</center>
<div style='position:absolute;z-index:0;left:0;top:0;width:100%;height:100%'>
<img class="transp" src=stampy6.png style='width:100%;height:100%' alt='[]' />
</div>
</body>
</html>
This is covering it: 这涵盖了它:
<div style='position:absolute;z-index:0;left:0;top:0;width:100%;height:100%'>
<img class="transp" src=stampy6.png style='width:100%;height:100%' alt='[]' />
</div>
Remove that code and you'll see what I mean. 删除该代码,您将明白我的意思。
An alternative: 替代:
<div style='position:absolute;left:0;top:0;'>
<img class="transp" src=stampy6.png alt='[]' />
</div>
用较小的值(例如10%)更改100%,图像将隐藏链接,这就是为什么您无法单击它。
It turns out I found out a solution! 原来我找到了解决方案! The "z-index" part of my code is at 0 (which shows that it has higher priority over my image (gaoosh.gif). So, I inserted this handy piece of code and: 我的代码的“ z-index”部分为0(这表明它比我的图片(gaoosh.gif)具有更高的优先级。因此,我插入了这段方便的代码,并:
h1{
position: relative;
top: 30px;
left: 50px;
z-index: 1;
}
Voila! 瞧! My image is now clickable. 我的图像现在可以单击。 But anyways, I want to thank you all of you who helped answer my question. 但是无论如何,我要感谢所有帮助回答我的问题的人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.