Creating popup tooltips is extremely easy if you're satisfied with the style defined by the client operating system. With a bit of style code and a bit of Java Script code you can control the appearance of your tooltips.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site
Your Ad Here!
Your ad here for one full year, only $20. Send me your ad copy, up to six lines, I'll post it ASAP. After you inspect your ad online, you can pay through PayPal.
Click here for more information.

Style Your Imagemap Tooltips

Tooltips are the text that pops up when you move your mouse pointer over an image, menu, or button that gives you a little information about that item. Tooltips can be useful for providing an object's nomenclature for selling things or for educational purposes. shown below is an example of tooltips used to identify the ports on the back of a Gateway 6520G2 notebook computer.

PC Card Slot Firewire Media Port USB Port Ethernet Modem USB Port

Creating tooltips is extremely easy. First you must define non-overlapping rectangular areas in the image where you want a tooltip to appear. To do this, load your image into Windows Paint program or your favorite graphics editor, then record the pixel locations of the upper-left and lower-right corners of each area. You do this by positioning your mouse pointer over the location and reading the x-y coordinates on the Paint program’s status bar.

Next, code an imagemap. The code for the imagemap used with the Gateway notebook computer example is shown below.

<map name="ports1">
<area shape="rect" coords="23,37,119,45" alt="PC Card Slot" href="#" />
<area shape="rect" coords="157,47,169,56" alt="Firewire" href="#" />
<area shape="rect" coords="178,47,220,53" alt="Media Port" href="#" />
<area shape="rect" coords="252,35,273,56" alt="USB Port" href="#" />
<area shape="rect" coords="284,40,303,56" alt="Ethernet" href="#" />
<area shape="rect" coords="305,40,323,56" alt="Modem" href="#" />
<area shape="rect" coords="330,49,378,56" alt="USB Port" href="#" />
</map>

The first line of the code is a map tag and it contains a name attribute. Following that are area tags that define areas of the image. Each area tag contains three attributes; the shape attribute defines the area to be a rect, the coords attribute is where you enter the pixel locations of the upper-left and lower-right corners of the area, the alt attribute is where you enter the text of the tooltip that you want to appear when the user moves the mouse pointer over the area.

The last thing you need to do is put the code to display the image. Shown below is the img tag used to display the Gateway notebook computer image.

<img border=0 width=414 height=80 src="gw6520G2.jpg" usemap="#ports1" />

The img tag contains a usemap attribute where you assign the name of the imagemap (prefixed with a "#" character).

That's all there is to it. If you're satisfied with these results, you're finished.

The problem with this method is that the style of the tooltip is defined by the client operating system, there's no way (that I know of) to style the "alt" portion of the imagemap area tag.

Now I'll show you another way to code an imagemap that gives you control over the appearance of your tooltips, as in the example shown below.

PC Card Slot Firewire Media Port USB Port Ethernet Modem USB Port

This method requires a bit of style code and a bit of Java Script code, but you don't need to know anything about Cascading Style Sheets or Java Script programming to use this example. I'll keep it simple and explain only generally how the code works and in detail only those specific lines you need to customize for your application.

Earn $1 to $5 to complete survey

Web Design Sections

RSS Feed RSS Feed

Cascading Style Sheets

[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2007 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269