为什么我无法为我的HTML代码制作可点击的链接?
问题描述:
我想为我的代码创建一个链接,以便人们可以单击它,但每当我将代码上传到我的文件时,我都无法点击它。有人可以帮忙吗?这里是我的代码:为什么我无法为我的HTML代码制作可点击的链接?
<!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>
答
这是覆盖它:
<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>
删除代码,你会明白我的意思。
一种替代方案:
<div style='position:absolute;left:0;top:0;'>
<img class="transp" src=stampy6.png alt='[]' />
</div>
答
变化100%,价值就像少了10%,图像隐藏的链接,这就是为什么你不能点击它。
+3
'图像隐藏了链接,这就是为什么你可以点击它.'不应该这样'图像隐藏链接,这就是为什么你不能点击它' –
+0
修改!感谢您的反馈意见:) – mongotop
答
原来我发现了一个解决方案!该“z-index的”我的代码部分为0(这表明它在我的图像(gaoosh.gif)具有更高的优先级,这样,我插入这个方便的一段代码和:
h1{
position: relative;
top: 30px;
left: 50px;
z-index: 1;
}
瞧! 但是,无论如何,我想感谢你们所有帮助我回答我的问题的人。
有没有保留这段代码并且建立链接?或者是否有完全不同的代码?谢谢回答 – montocore
不,你可以用不同的方式来解决问题。是stampy6.png你的标志?你可以将它设置为页面背景,将它浮动在左上方等。没有真正看到图像,很难说出你想要的东西。做/看起来像。 –
stampy 6.png已经是我透明的背景图片。我想要做的是让我的图像(gaoosh.gif)可点击。 – montocore