SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: imag alt

  1. #1
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    imag alt

    http://dot.kr/x-test/doc37.cfm has the code below.

    Code:
    <img src='dokdo.jpg' alt='my alt text'/>
    I can see "my alt text" when I put my mouse on the image in IE,
    but I can't see it when I put my mouse on the image in google chrome or fireFox.

    Why is the value of alt not shown in google chrome or fireFox?

    How can I make it to be shown in google chrome or fireFox?

  2. #2
    @alexstanford Alex's Avatar
    Join Date
    Apr 2004
    Location
    Jacksonville, Florida
    Posts
    757
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    To support those browsers, try:

    Code:
    <img src='dokdo.jpg' alt='my alt text' title='my alt text' />
    Alex
    Alex Stanford @alexstanford tumblog about.me in fb G+ K
    TechTalkin The Premier Community for Technology Enthusiasts and Professionals
    Full Ambit Media Zero Sacrifice Web Design & Development; Made in the USA @fullambit in fb G+ K

  3. #3
    Resident curmudgeon bronze trophy gary.turner's Avatar
    Join Date
    Jan 2009
    Location
    Dallas
    Posts
    990
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Be aware that the alt attribute's text is not supposed to be seen unless the image cannot be loaded for some reason. For it to display (tooltip) when hovering on the image, is improper.

    If you want a tooltip on hover, the correct attribute to use is title.

    cheers,

    gary
    Anyone can build a usable website. It takes a graphic
    designer to make it slow, confusing, and painful to use.

    Simple minded html & css demos and tutorials

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by dotJoon View Post
    I can see "my alt text" when I put my mouse on the image in IE
    That is a bug in IE - the alt text is only supposed to be shown when the image can't be displayed. To fix the IE bug add a title="" attribute. Leave the title attribute empty if you just want to fix the IE bug and include any tooltip text in it (just as you would for a title attribute on ANY tag) if you want it to display when the mouse moves over it.
    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="^$">

  5. #5
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,893
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by dotJoon View Post
    http://dot.kr/x-test/doc37.cfm has the code below.

    Code:
    <img src='dokdo.jpg' alt='my alt text'/>
    I can see "my alt text" when I put my mouse on the image in IE,
    but I can't see it when I put my mouse on the image in google chrome or fireFox.

    Why is the value of alt not shown in google chrome or fireFox?

    How can I make it to be shown in google chrome or fireFox?
    Chrome, Firefox and all other browsers are behaving right. IE is being naughty.

    Alt text is just that - alternative text, to be used when the image isn't available or can't be displayed. It should not be shown at any time when the image is there.

    To get a toolip, you should use the (optional) title attribute on the image, eg
    <img src="dokdo.jpg" alt="Dokdo picture" title="Picture of me and Dokdo">
    If you do this, all browsers (including IE) will show the title text as a tooltip.


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
  •