如何为图像的某些部分创建链接?

时间:2015-03-13 08:58:47

标签: javascript html css

我有一个人体的图像,我应该使所有器官如眼睛,鼻子和耳朵可以点击链接到不同的网页。这是否可以与HTML和/或JavaScript开箱即用?

1 个答案:

答案 0 :(得分:2)

尝试使用image maps

例如:

<img src="http://www.w3schools.com/tags/planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" href="http://www.w3schools.com/tags/sun.htm" alt="Sun">
  <area shape="circle" coords="90,58,3" href="http://www.w3schools.com/tags/mercur.htm" alt="Mercury">
  <area shape="circle" coords="124,58,8" href="http://www.w3schools.com/tags/venus.htm" alt="Venus">
</map>