Assign TITLE content to HREFs

admin

Administrator
Staff member
I have a series of SPAN tags throughout my HTML document, eg: <span class="myclass">.

I use these SPAN tags to assign color and text formatting to certain pieces of text with the MYCLASS style.

All of these SPAN tags also have a TITLE attribute set to make a "tooltip" pop up when the mouse moves over these pieces of text.

The TITLE on each of these pieces of text is exactly the same. I was wondering if I could set the TITLE text somewhere in the MYCLASS CSS script.

Does anyone know if this is possible? If so, can someone show me how it's done?

If it's possible, I'd imagine you could also use it with setting the ALT tag on images too!

Cheers,

Chris

PS: I've just spent the last hour searching the forums and haven't seen this question asked anywhere!Not with CSS, although easily done with JavaScript.
btw the alt attribute value is used when the image is not available, not as a tooltip.Thanks Fang,

Yeah, I suspected JS would be required.

I use the TITLE attribute for that very reason. I only use ALT attributes on images if it is critical that the user needs to know what that image represents in case for whatever reason, the image doesn't load.

...of course, IE encourages use of ALT attributes instead of TITLE attributes by making them show a popup too!

Many thanks!
 
Back
Top