对于要给图片的一个部分加链接时,可以使用html的map标签:
<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" />
<map name="planetmap" id="planetmap">
<area shape="circle" coords="180,139,14" href ="venus.html" alt="Venus" />
<area shape="circle" coords="129,161,10" href ="mercur.html" alt="Mercury" />
<area shape="rect" coords="0,0,110,260" href ="sun.html" alt="Sun" />
</map>
当shape=circle时,三个数字依次为:中心点X、中心点Y、半径
当shape=poligon时,可定义多个路径点,依次为:起点X、起点Y、路径1X、路径1Y、路径2X、路径2Y
当shape=rect时圈定部分为矩形,四个数字依次为:起点X、起点Y、终点X、终点Y,坐标原点为图片左上方,坐标系如下图
给上图A区域加一个链接的代码为:
<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" />
<map name="planetmap" id="planetmap">
<area shape="rect" coords="700,0,730,20" href ="sun.html" alt="Sun" />
</map>