SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Jul 2008
    Location
    Port Elizabeth, South Africa
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Displaying the alt text of image

    Hi - I've just discovered that IE is the only browser that displays the alt text of an image when you hover over it. Is there a way to force the other browsers to display it? Opera + FF give the <a ref> which is useless. And Safari is totally silent as to what an icon stands for.

    e.g. my email icon (which looks more like a printer with paper in it, than an envelope) has the alt of "Email help@eatsprouts.com" which I need people to see!

    thanks, Val

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    Use the title attribute with the alt attribute.

    <a href="" alt="some text" title="some text"></a>
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IE is doing it wrong, as usual. The alt attribute is the text equivalent of the image, meant to show when the image cannot be shown (e.g., because the browser doesn't support images, because the user has turned off images, or because the image is unavailable). It is not meant to be shown together with the image.

    As ScallioXTX says, you should use the title attribute for non-critical, advisory titles.

    BTW, that's also the trick to prevent IE from showing alt attribute text (since a good alt text is rarely suitable for a tool-tip text):
    Code HTML4Strict:
    <img src="..." alt="text equivalent" title="">
    Birnam wood is come to Dunsinane

  4. #4
    SitePoint Evangelist
    Join Date
    Jul 2008
    Location
    Port Elizabeth, South Africa
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you! - works beautifully in all browsers - Val


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •