我的图像里面有不同的物体。 有没有办法可以将不同的标题属性关联到此图像中的不同对象?
谢谢
////我找到了这个问题的解决方案////
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.
答案 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上不适用于工具提示。