Standards-compliant tool-tips

I know that everybody in the world but me already knew this, but I finally sorted out what appears to be a workable cross-browser way to do tooltips.

As it turns out, the major browsers display the contents of the “title” attribute as the tool-tip that appears on, for example, anchor tags. It turns out that IE also, and in apparent violation of the standard, uses the value of the “alt” attribute if the title attribute is missing.

For now, until I am convinced to the contrary, I’ll use the “alt” attribute of each img tag to describe the image for text-only browsers. I’ll use the “title” attribute to contain the tooltip contents (limiting it to 75 characters in deference to Firefox behavior).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: