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 Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact Advertise on Bucaro TecHelp Advertise Here RSS News Feeds News Feeds

HTML5 Solutions: Essential Techniques for HTML5 Developers

Essential Techniques for HTML5 Developers

HTML5 brings the biggest changes to HTML in years. Web designers now have new techniques, from displaying video and audio natively in HTML, to creating realtime graphics on a web page without a plugin.

This book provides a collection of solutions to all of the most common HTML5 problems. Every solution contains sample code that is production-ready and can be applied to any project.

Click Here

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.



RSS Feed RSS Feed

Web Design Sections

CSS3: Visual QuickStart Guide (5th Edition)

With this book, readers can start with a tour of the stylesheet language, or skip ahead to any chapter of the book to look up specific tasks covering just what they need to know. This task-based, visual reference guide uses step-by-step instructions, and plenty of screenshots to teach beginning and intermediate users CSS.

Reader David Diez of Boston, MA says, "This book's strategy seems to be show an example, give a general explanation, provide a few key but brief tips, move on. The writing is clear and concise. ... I continue to be very pleased and impressed with the book. It's proving to be a helpful reference and everything in it is highly accessible. Click here for more information.


[Site User Agreement] [Advertise on This site] [Search This Site] [Contact Form]
Copyright©2001-2011 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268