1 张图片 2 个链接
如何使图像在图像的不同区域的 HTML 中可点击并导致不同的 URL...例如,我有一个图像或“按钮”,如果你愿意的话,那是 1 个图像,但我希望它实际上是 2 个链接...按钮的一侧是“注册”,而另一侧是“试用”
how do you make an image be clickable in in HTML in different areas of the image and lead to different URL's... for instance I have an image or "button" if you will that is 1 image but I want it to actually be 2 links... one side of the button is "sign up" while the other side is "try out"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 HTML 图像映射: http://www.javascriptkit.com/howto/imagemap.shtml
示例:
Use HTML image maps: http://www.javascriptkit.com/howto/imagemap.shtml
Example:
使用 CSS-sprites
我认为最好的方法是使用 CSS sprite: http://www.css-sprites.html jsfiddle.net/pereskokov/vVhde/1/。
使用它的主要好处 - 您的图像不会成为内容的一部分,而只是装饰。这样您的内容就可以访问。您还可以通过 CSS 轻松更改网站的装饰并使用其他图像。
仅当图像是内容的一部分时,使用
map
才是合理的 - 例如,它是 真实地图 :)HTML
CSS
Use CSS-sprites
I think that the best way is to use CSS sprite: http://www.jsfiddle.net/pereskokov/vVhde/1/.
Main benefit of using it — your image will not be a part of content, it's just decor. So your content will be accessible. Also you can easy change decoration of your site via css and use another image.
Using
map
is justified only when image is part of content — for exemple, it is real map :)HTML
CSS