img上的href链接 [英] a href link on img

查看:340
本文介绍了img上的href链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我有以下代码在 img 之上有几个链接。它在FF中运行良好,但不在IE中运行。如果您将链接放在 img

Hi I have the following code to have few links on top of img. It works well in FF but not in IE. It seems IE is not clickable if you put link on top of img

<div style="z-index:-6755;"><img alt="October Offer" src="images/offers/october-offer.jpg" /></div>
<a href="javascript:void(0);" onclick="window.parent.SqueezeBox.close();" style="text-decoration: none; width: 147px; height: 32px; position: inherit; bottom: 32px; left: 50px; border: 1px solid red; display: block;" target="_parent"> </a> 

<a href="#" onclick="window.parent.SqueezeBox.close();">
<div style="display:block; width: 185px; height: 32px; position: relative; bottom: 50px; left: 260px;border:1px solid blue; ">&nbsp;</div>
</a>


推荐答案

您只是想让图片可点击吗?

are you just trying to make the image clickable?

您不能有< href> 这不是正确的html标记。

you can't have <href> that's not a correct html tag.

< a> 内放置< img> ,如下所示:< a href =http://www.example.com/>< img />< / a>

either place <img> inside <a> like so: <a href="http://www.example.com/"><img /></a>

另一种方法是设置一个带有图像背景图片的div,然后在其中创建一个链接,将链接显示为:block并将其设置为div的整个宽度和高度,整个事情将会是可点击。

another way is to set a div with a background image of your image and then a link inside there, make the link display : block and make it the entire width and height of the div and the whole thing will be clickable.

这篇关于img上的href链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆