Alt text doesn't show as tooltip in some browsers

Everything related to GBook PHP guestbook
Post Reply
gildionne
Posts: 18
Joined: Thu Nov 16, 2006 4:21 pm

Alt text doesn't show as tooltip in some browsers

Post by gildionne »

/*************************************
Title:gbook
Version:1.6
Author:
Demo:www.gilsbus.ca/gbook/gbook.php
Download:
Website:www.gilsbus.ca

Short description:
Need a gbook modification to allow tooltips to work when you hover over a menu image

*************************************/

The 'alt' text attribute that shows a text message when an image is NOT available, does not trigger the tooltip feature in compliant browsers like Firefox. The solution is to use the 'title' attribute. I find that my version of IE, Firefox and Opera all display the tooltip text when hovering over an image that has the 'title' attribute set.

I have modified my version of gbook to include this attribute, if anyone wishes to try it out.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

The standard is to use ALT, title is not required but I guess it won't be hard to add it to the next version, thanks for the note.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
gildionne
Posts: 18
Joined: Thu Nov 16, 2006 4:21 pm

Post by gildionne »

Here are two links to www.w3school.com pages which the define the correct use of both the 'alt' and 'title' attributes. It also mentions in the first link that Internet Explorer does not follow the HTML specification and it incorrectly displays the 'alt' text as a tooltip.

http://www.w3schools.com/tags/att_img_alt.asp
http://www.w3schools.com/tags/att_standard_title.asp

The specification is for the 'alt' attribute to display the text only if the image is not available, while the 'title' attribute will always display tooltip text.

I have noticed that if I add a null 'title' attribute (title="") to an 'img' tag that has an 'alt' attribute set (alt="foobar"), no tooltip will be displayed, even in IE7.
Post Reply