SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Location
    Ljubljana
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    displaying img alt tag over div

    Hello,

    I have an image slide gallery (jquery cycle) with alt tags, covered with 2 divs for moving forward and back. It appears that since the div covers image, the image alt tag won't be displayed when I hold the cursor over the image.

    How could I solve this issue so that alt tag would show up normally like without divs?

    Thanks for help
    Get RankTrackr 2.0: Rank Tracker | PopStrap

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,786
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The alt attribute is only supposed to display when the browser can't display the image and has nothing to do with the cursor. You are getting it confused with the title attribute which is some browsers produces a tooltip effect above whatever tag it is attached to. You should attach the title attribute to whichever tag is on top so that it can be properly displayed or alternatively generate the tooltip using Javascript so that it always appears as a tooltip (as some browsers put the title text into the status bar instead).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    He's probably working with Internet Explorer. IE6 and 7 display alt as a tooltip. Suffice it to say that using the alt attribute this way is wrong.

    Same goes for the title attribute. It's also wrong to assume that the title attribute is a mechanism for generating a tooltip. It's simply more common in the case of title than it is for alt.

  4. #4
    SitePoint Addict
    Join Date
    May 2006
    Location
    Ljubljana
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for explanation
    Get RankTrackr 2.0: Rank Tracker | PopStrap

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,786
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by lpcstr View Post
    Same goes for the title attribute. It's also wrong to assume that the title attribute is a mechanism for generating a tooltip. It's simply more common in the case of title than it is for alt.
    I did mention that some browsers display it in the statusbar instead and that if you really want it displayed as a tooltip then you need to use JavaScript to create it.

    To fix the IE bug you simply need to include title="" in your images as well as the mandatory alt attribute. Then IE will behave the same as other browsers.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •