alt and title in <img> tag?

Discussion in 'HTML' started by Suzanne Knapp, Jul 4, 2005.

  1. Is it ok to use both alt and title attributes in an <img> tag (so all
    browsers will honor at least one of them)?
     
    Suzanne Knapp, Jul 4, 2005
    #1
    1. Advertising

  2. Suzanne Knapp

    Dylan Parry Guest

    Using a pointed stick and pebbles, Suzanne Knapp scraped:
    > Is it ok to use both alt and title attributes in an <img> tag (so all
    > browsers will honor at least one of them)?


    Yes, it is fine. In fact you *should* be using alt attributes for all
    your images. With regards support, I don't know of any browsers that
    *don't* support the alt attribute, but I think that Netscape 4 didn't
    support title attributes.

    Internet Explorer will use the alt attribute as a tooltip, which is
    wrong, but will use the title attribute in preference if it is present.

    --
    Dylan Parry
    http://electricfreedom.org -- Where the Music Progressively Rocks
     
    Dylan Parry, Jul 4, 2005
    #2
    1. Advertising

  3. Suzanne Knapp

    Dan Guest

    Suzanne Knapp wrote:
    > Is it ok to use both alt and title attributes in an <img> tag (so all
    > browsers will honor at least one of them)?


    You should use them in accordance with their standards-compliant
    purpose; the ALT attribute is required for all images and should
    consist of whatever the image ought to be replaced with if not
    displayed (e.g., in a text browser), which may sometimes be a null
    string (for spacers and purely decorative images). The TITLE attribute
    is not required, but can be used for supplemental information where
    this is relevant.

    --
    Dan
     
    Dan, Jul 4, 2005
    #3
  4. Suzanne Knapp

    Vladdy Guest

    Dan wrote:
    > You should use them in accordance with their standards-compliant
    > purpose; the ALT attribute is required for all images and should
    > consist of whatever the image ought to be replaced with if not
    > displayed (e.g., in a text browser), which may sometimes be a null
    > string (for spacers and purely decorative images).

    Spacers have reason to be in HTML in this day and age.
    Purely decorative images belong in CSS as element backgrounds.

    --
    Vladdy
    http://www.klproductions.com
     
    Vladdy, Jul 4, 2005
    #4
  5. Thanks. I didn't realize that IE's display of Alt text was erroneous - I
    thought that was what was supposed to happen, and was surprised when FireFox
    didn't do it. At the FF site I learned that they would display Title text,
    so thought that using both attributes (with the same text) would give me
    what I wanted. So far so good with IE 6 and FF, haven't tried any others
    yet.

    "Dylan Parry" <> wrote in message
    news:...
    > Using a pointed stick and pebbles, Suzanne Knapp scraped:
    >> Is it ok to use both alt and title attributes in an <img> tag (so all
    >> browsers will honor at least one of them)?

    >
    > Yes, it is fine. In fact you *should* be using alt attributes for all your
    > images. With regards support, I don't know of any browsers that *don't*
    > support the alt attribute, but I think that Netscape 4 didn't support
    > title attributes.
    >
    > Internet Explorer will use the alt attribute as a tooltip, which is wrong,
    > but will use the title attribute in preference if it is present.
    >
    > --
    > Dylan Parry
    > http://electricfreedom.org -- Where the Music Progressively Rocks
     
    Suzanne Knapp, Jul 4, 2005
    #5
  6. Suzanne Knapp

    dorayme Guest

    > From: Dylan Parry <>
    >
    > Using a pointed stick and pebbles, Suzanne Knapp scraped:
    >> Is it ok to use both alt and title attributes in an <img> tag (so all
    >> browsers will honor at least one of them)?

    >
    > Yes, it is fine. In fact you *should* be using alt attributes for all
    > your images. With regards support, I don't know of any browsers that
    > *don't* support the alt attribute, but I think that Netscape 4 didn't
    > support title attributes.
    >
    > Internet Explorer will use the alt attribute as a tooltip, which is
    > wrong, but will use the title attribute in preference if it is present.
    >


    I'd say to be careful about titles, they seem to invariably produce pop out
    bubbles which are sometimes a distracting nuisance...

    (1) Once I was greatly irritated because I was using the mouse to point
    things out to someone in a picture, every time the mouse moved the bubble
    would pop up. (2) I have had cases of these pop outs obscuring things I
    wanted to see. (3) I *wanted* to read the content of the bubbles but they
    refused to stay long enough! (Sorry, it sounds like I am hard to please...
    but there is a serious point here.)

    Surely all browsers "honor" alt tags? So the decision is when to use
    "title". I'd say, only if you want the viewer to briefly see some very short
    extra info ... in an image not likely to be so great that a viewer might
    want to lovingly feel all over it with a mouse...

    dorayme
     
    dorayme, Jul 5, 2005
    #6
  7. The popouts are the effect I was trying for, so Title is fine for that
    purpose. They stay on as long as the cursor is over the image, which is
    what I want. The only problem is older browsers that don't display title
    text, and the Alt text covers those (at least the ones I know about).

    Suzanne

    "dorayme" <> wrote in message
    news:BEF006CD.14191%...
    >> From: Dylan Parry <>
    >>
    >> Using a pointed stick and pebbles, Suzanne Knapp scraped:
    >>> Is it ok to use both alt and title attributes in an <img> tag (so all
    >>> browsers will honor at least one of them)?

    >>
    >> Yes, it is fine. In fact you *should* be using alt attributes for all
    >> your images. With regards support, I don't know of any browsers that
    >> *don't* support the alt attribute, but I think that Netscape 4 didn't
    >> support title attributes.
    >>
    >> Internet Explorer will use the alt attribute as a tooltip, which is
    >> wrong, but will use the title attribute in preference if it is present.
    >>

    >
    > I'd say to be careful about titles, they seem to invariably produce pop
    > out
    > bubbles which are sometimes a distracting nuisance...
    >
    > (1) Once I was greatly irritated because I was using the mouse to point
    > things out to someone in a picture, every time the mouse moved the bubble
    > would pop up. (2) I have had cases of these pop outs obscuring things I
    > wanted to see. (3) I *wanted* to read the content of the bubbles but they
    > refused to stay long enough! (Sorry, it sounds like I am hard to please...
    > but there is a serious point here.)
    >
    > Surely all browsers "honor" alt tags? So the decision is when to use
    > "title". I'd say, only if you want the viewer to briefly see some very
    > short
    > extra info ... in an image not likely to be so great that a viewer might
    > want to lovingly feel all over it with a mouse...
    >
    > dorayme
    >
     
    Suzanne Knapp, Jul 5, 2005
    #7
  8. Suzanne Knapp

    Mark Parnell Guest

    Previously in alt.html, dorayme <> said:

    > I'd say to be careful about titles, they seem to invariably produce pop out
    > bubbles which are sometimes a distracting nuisance...


    On IE, alt does the same.

    > Surely all browsers "honor" alt tags?


    *Attributes*. alt *attributes*. :)

    > So the decision is when to use
    > "title".


    Use an empty title (title="") to stop IE from displaying the alt
    attribute as a tooltip.

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    alt.html FAQ :: http://html-faq.com/
     
    Mark Parnell, Jul 5, 2005
    #8
  9. Suzanne Knapp

    Mark Parnell Guest

    Previously in alt.html, Suzanne Knapp <> said:

    > Thanks. I didn't realize that IE's display of Alt text was erroneous - I
    > thought that was what was supposed to happen,


    A common misconception, thanks to IE's behaviour. :-(

    According to the specs -
    http://www.w3.org/TR/html4/struct/objects.html#adef-alt - the alt
    attribute specifies a textual *alternative* to the image. IOW, it is
    supposed to be displayed only if the image *isn't*, for whatever reason.

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    alt.html FAQ :: http://html-faq.com/
     
    Mark Parnell, Jul 5, 2005
    #9
  10. Suzanne Knapp

    Mark Parnell Guest

    Mark Parnell, Jul 5, 2005
    #10
  11. Suzanne Knapp

    dorayme Guest

    > From: "Suzanne Knapp" <>
    > Newsgroups: alt.html
    > Date: Mon, 04 Jul 2005 23:58:54 GMT
    > Subject: Re: alt and title in <img> tag?
    >
    > The popouts are the effect I was trying for, so Title is fine for that
    > purpose. They stay on as long as the cursor is over the image, which is
    > what I want. The only problem is older browsers that don't display title
    > text, and the Alt text covers those (at least the ones I know about).
    >
    > Suzanne



    Yes, I gathered that you probably did want this popout. In my experience
    there is a time limit for their existence even if the mouse is not moved but
    I won't bother you on this as it might be a quirk of my mac browsers (I am
    now wondering if there is any setting for this?). Still, I do think it is
    probably a good idea to keep the title nice and short for reasons you can
    gather from my last post...

    dorayme
     
    dorayme, Jul 5, 2005
    #11
  12. Suzanne Knapp

    Mark Parnell Guest

    Previously in alt.html, dorayme <> said:

    > In my experience
    > there is a time limit for their existence even if the mouse is not moved


    In Mozilla/Netscape/Firefox it is about 6 secs IIRC.

    > (I am
    > now wondering if there is any setting for this?).


    Not in any browser that I know of.

    > Still, I do think it is
    > probably a good idea to keep the title nice and short for reasons you can
    > gather from my last post...


    Plus the Mozilla family of browsers doesn't always display the whole
    title attribute anyway - it cuts it off if it is too long. It depends on
    exactly what it is, but it tends to be around 100 characters.

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    alt.html FAQ :: http://html-faq.com/
     
    Mark Parnell, Jul 5, 2005
    #12
  13. Suzanne Knapp

    dorayme Guest

    > From: Mark Parnell <>
    >
    > Previously in alt.html, dorayme <> said:
    >
    >> I'd say to be careful about titles, they seem to invariably produce pop out
    >> bubbles which are sometimes a distracting nuisance...

    >
    > On IE, alt does the same.
    >

    Yes, I know but one *has* to put in alt attributes if one wants to be kosher
    ....

    >> Surely all browsers "honor" alt tags?

    >
    > *Attributes*. alt *attributes*. :)
    >

    Yes, and oops! But thanks, loose talk...
    >
    >> So the decision is when to use
    >> "title".

    >
    > Use an empty title (title="") to stop IE from displaying the alt
    > attribute as a tooltip.
    >

    Ah so! An interesting point, especially for me who is keen to be sparing
    about tooltips.

    dorayme
     
    dorayme, Jul 5, 2005
    #13
  14. Suzanne Knapp

    dorayme Guest

    > From: Mark Parnell <>
    >


    Just a further note, on one IE (for Mac version 5.1.6), the alt attribute
    does not trigger tool tips, the title does though when added. There are many
    features to IE 5 for Macs that seem much more solid than the PC version. I
    understand that the people who developed the Mac version had a bigger clue
    about what they were doing (one source for this was a remark by SP a while
    back, but also others and my own observations)
     
    dorayme, Jul 5, 2005
    #14
  15. dorayme wrote:

    > I'd say to be careful about titles, they seem to invariably produce
    > pop out bubbles which are sometimes a distracting nuisance...


    The day I turned off "tooltips" (in which category Opera includes the
    title attribute) for good was the day I was trying to read a long
    article on a page with very long paragraphs where each *entire
    paragraph* (i.e., nearly the whole page!) had a title. It kept popping
    up boxes every time I brought the cursor onto the page to click a link.
    And the titles were something useless like "Chapter 14".

    I only have one title attribute at blinkynet, and it's been there for
    years. Last week, I added a second, and scratched a small bald spot on
    my head, trying to figure out why Opera (which is no longer my primary
    browser) wouldn't show it. :)

    --
    Blinky Linux Registered User 297263
    Killing all Usenet posts from Google Groups
    Info: http://blinkynet.net/comp/uip5.html
    *ALSO contains links for access to the NON-BETA GG archive interface*
     
    Blinky the Shark, Jul 5, 2005
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Do
    Replies:
    1
    Views:
    3,034
    Ken Cox [Microsoft MVP]
    Nov 23, 2003
  2. news.austin.rr.com

    how to download img from html img tag

    news.austin.rr.com, Apr 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    538
    Steve C. Orr [MVP, MCSD]
    Apr 27, 2005
  3. shruds
    Replies:
    1
    Views:
    932
    John C. Bollinger
    Jan 27, 2006
  4. Thomas Fuchs

    IMG ALT Attribute with Mozilla

    Thomas Fuchs, Apr 17, 2005, in forum: HTML
    Replies:
    6
    Views:
    4,574
    Tonnie
    Apr 17, 2005
  5. entrepreneur

    Using ALT And TITLE Attributes

    entrepreneur, Oct 26, 2006, in forum: HTML
    Replies:
    7
    Views:
    435
    Jukka K. Korpela
    Oct 28, 2006
Loading...

Share This Page