tags:

views:

39

answers:

1

Hello all,

I have an image with different objects inside. Is there a way that I can associate different title attributes to different objects inside this image?

Thank you

//// I have found a solution for this question ////

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.
+3  A: 

You can use map tag with a title attribute on area element:

<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>

For some reason, alt attribute doesn't works on Chrome as a tooltip.

Rubens Farias
You probably mean the `alt` attribute of the `area` tag.
Gert G
@Gert I don't think browsers were ever mean to show `alt` as a tooltip - that was IE being IE.
alex
Quite correct about alt and title. According to the W3 specs, "alt" is a "text equivalent" shown instead of an image, while "title" is "advisory information" shown in addition to an image. It is basically a bug if browsers show alt as tooltip.
Joeri Sebrechts