Clarification on title and alt attributes on images.

Discussion in 'HTML & Website Design' started by Bagless, Jun 20, 2009.

  1. #1
    I've always struggled to understand the difference between the "title" and "alt" attributes on images.

    What would the effect if, on the same image src, I attributed a different title to the alt....and would it make a difference to search engine bots.

    Any thoughts?
     
    Bagless, Jun 20, 2009 IP
    JDF likes this.
  2. JDF

    JDF Banned

    Messages:
    703
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Alt is not meant to be used as a tool tip, or more specifically, to provide additional information about an image. The title attribute, on the other hand, is meant to provide additional information about an element. That information is displayed as a tooltip by most graphical browsers, though manufacturers are free to render title text in other ways.

    Good question, rep added!
     
    JDF, Jun 20, 2009 IP
  3. TechnoGeek

    TechnoGeek Peon

    Messages:
    258
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hello.

    The "alt" attribute is part of the HTML 4 specification. The "title" attribute is not. It was introduced in Microsoft browsers and so it ended being a kind of "de facto" standard, but its use should be deprecated. "Alt" was introduced in the specification to the effect of providing a textual description of the image when the browser was unable to display images (old times...) or the user had disabled the displaying of images to speed the downloading of pages (also old times...). Later, browsers added the capability of showing a hint when the mouse cursor passes over the image.

    See this page:

    SitePoint reference IMG
     
    TechnoGeek, Jun 21, 2009 IP
  4. larryatdp

    larryatdp Peon

    Messages:
    217
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Also the text in "alt" will not be shown in Firefox when the mourse cursor passes over the image if that image can be displayed. But it will in IE.
     
    larryatdp, Jun 21, 2009 IP
  5. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #5
    Since when?
    To the contrary, its use is encouraged now that browsers use the title property properly.
     
    drhowarddrfine, Jun 21, 2009 IP
  6. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #6
    And, of course, Firefox is performing correctly while IE is not.
     
    drhowarddrfine, Jun 21, 2009 IP
  7. myndconsulting

    myndconsulting Peon

    Messages:
    60
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    The "title" text is displayed as a tooltip/caption for an image.

    The "alt" text is displayed when image display is turned off on a browser.

    For SEO purposes and text only browsers, the "alt" attribute is very important.
     
    myndconsulting, Jun 22, 2009 IP
  8. TechnoGeek

    TechnoGeek Peon

    Messages:
    258
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Sorry for the confusion.

    "Title" was not an attribute of the image tag in HTML 3.2, but it was of the anchor tag since HTML 2. It was recognized by Internet Explorer since version 4.0B1. The name "title" comes because it was supposed to be filled with the title of the linked document.

    The "alt" attribute belongs to the image tag since HTML 2, and it was in the HTML 3.2 Specification. It was recognized by Internet Explorer since version 1. See

    http://www.w3.org/TR/REC-html32

    "Title" was added to the attributes of the image tag in the HTML 4.01 Specification, as part of the "coreattrs" attributes. This expands the use of the "title" attribute to many other tags. See:

    http://www.w3.org/TR/html4/struct/objects.html#h-13.2

    Thanks, drhowarddrfine.
     
    TechnoGeek, Jun 22, 2009 IP
  9. Bagless

    Bagless Active Member

    Messages:
    594
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    70
    #9
    Thanks for all the info guys, really appreciate it. Just need to spend a bit of time adding titles to all my images now then (always wondered why nothing came up when you hovered over them in Firefox).

    I am guessing that you can add the title attribute to links as well then, to give a tool tip on those also?
     
    Bagless, Jun 22, 2009 IP
  10. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #10
    As I said.
     
    drhowarddrfine, Jun 22, 2009 IP
  11. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #11
    Yes. .
     
    drhowarddrfine, Jun 22, 2009 IP
  12. Bagless

    Bagless Active Member

    Messages:
    594
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    70
    #12
    Where's the thanks button when you need it :confused:
     
    Bagless, Jun 24, 2009 IP
  13. Scripter

    Scripter Peon

    Messages:
    403
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #13
    I think best practise would be alt tags for images only and title tags for links. Alt for images is important to make a site barrier free and is helpful for SEO purposes, but I don't see any real use for titles on images as long as they aren't linked anywhere.
     
    Scripter, Jun 24, 2009 IP
  14. Bagless

    Bagless Active Member

    Messages:
    594
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    70
    #14
    I did as people had advised, thanks for that. Let's see if it (the new alt tags) affects SERPS.
     
    Bagless, Jul 7, 2009 IP