HTML - 如何将标题属性用作图像不同部分的工具提示

时间:2010-09-05 23:06:07

标签: html

我的图像里面有不同的物体。 有没有办法可以将不同的标题属性关联到此图像中的不同对象?

谢谢

////我找到了这个问题的解决方案////

Here is what we can do:
1> Add a DIV with an image as its background
2> Add a sub DIV inside this image DIV
3> Position this sub DIV
4> Change the title properties of this sub DIV.

1 个答案:

答案 0 :(得分:3)

您可以在title元素上使用map tag area属性:

<img src="planets.gif" width="145" height="126" usemap="#planetmap" />
<map name="planetmap">
  <area shape="rect"   coords="0,0,82,126" title="Sun"     href="sun.htm"    />
  <area shape="circle" coords="90,58,3"    title="Mercury" href="mercur.htm" />
  <area shape="circle" coords="124,58,8"   title="Venus"   href="venus.htm"  />
</map>

由于某些原因,alt属性在Chrome上不适用于工具提示。