|
|
 |
|
| Garry |
|
NetHosted Customer

Joined: 03 Oct 2005 Posts: 243 Location: Lincoln, UK
|
Posted: Sun Dec 09, 2007 11:59 am Post subject: alt & title |
| |
Hi,
Do you use both alt and title in your html for images or do you just use one of them.
I have noticed alt does not work in Firefox, however title works in both Firefox and IE. But have not tested any others _________________ Regards,
Garry |
|
| Back to top |
|
| boughtonp |
|
NetHosted Customer
Joined: 18 Jul 2005 Posts: 129 Location: South Croydon
|
Posted: Sun Dec 09, 2007 1:03 pm Post subject: |
| |
Alt does work for Firefox - it does exactly what it was intended to do, which is show alternate text for users without images enabled.
Using Alt for tooltips is something which Microsoft decided to do without paying attention to the actual standards.
Title is the attribute designed explicitly for tooltips (for all tags, not just images), and thus is what you should use when you want a tooltip to display.
Also, you should not be using the same value for both Alt and Title - because a tooltip should usually be different, especially in the case of icons, for example:
| Code: | | <img src="images/red-x.png" alt="[X]" title="Delete this member" onclick="deleteMember(id=5)"/> |
Also, remember that Title works for all tags and is not restricted to images:
| Code: | | <a href="large_image.jpg" title="View larger image"><img src="small_image.jpg" alt="a photo of the sun setting behind some distance islands with a beautiful red sky"/></a> |
| Code: | | <abbr title="NetHosted">NH</abbr> |
| Code: | | <button title="To page 5 of 7">Next</button> |
_________________ Peter Boughton |
|
| Back to top |
|
| petethegeek |
|
NetHosted Customer

Joined: 14 Feb 2005 Posts: 189 Location: Worcester
|
Posted: Mon Dec 10, 2007 8:16 am Post subject: |
| |
Just to extend a little on Peter's excellent explanation; you can also use CSS to generate tooltips, particularly on links, in a very flexible fashion. See here for a starter, or simply google on 'css tooltip'.
Regards,
Pete _________________ "I have made this letter long, only because I lacked the time to make it short." - Blaise Pascal 1657 |
|
| Back to top |
|
| boughtonp |
|
NetHosted Customer
Joined: 18 Jul 2005 Posts: 129 Location: South Croydon
|
Posted: Mon Dec 10, 2007 7:55 pm Post subject: |
| |
Although doing flexible tooltips in the way that article suggests is completely wrong.
The correct way is not to embed tips in the content, but instead to preserve the title attribute and use JS to create a tooltip from the title. _________________ Peter Boughton |
|
| Back to top |
|
| boughtonp |
|
NetHosted Customer
Joined: 18 Jul 2005 Posts: 129 Location: South Croydon
|
Posted: Mon Dec 10, 2007 8:13 pm Post subject: |
| |
I've created a quick example of how a JS-driven tooltip can work .
As it preserves the title attribute and doesn't use nested hidden spans, it is semantically correct and falls back to a regular tooltip if JS is unavailable.
However, with JS you get a fancy blue tooltip instead, and you can obviously go off and style away to your heart's content.  _________________ Peter Boughton |
|
| Back to top |
|
User Permissions |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
| |
| |
|
 |
 |
| | |