SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Thread: Adding ALT TAG to text in HTML

  1. #1
    SitePoint Enthusiast smilinjack's Avatar
    Join Date
    Nov 2004
    Location
    Wilds of Borneo And the vineyards of Bordeaux
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Adding ALT TAG to text in HTML

    Greetings,
    How can I add "Alt Tags" to text.
    Easy to do to images but can't figure it out on text.
    As always thanks in advance!!!

    Jack
    North to Alaska !

  2. #2
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,462
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    use the TITLE attribute instead

    by the way, ALT is not a tag, it is an attribute of the IMG tag
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    \m/\m/ karinne's Avatar
    Join Date
    Dec 2002
    Location
    Aylmer, QC, Canada
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not just the img element but AREA, APPLET, and INPUT as well...

    But like I said in another forum you posted ... what would be the purpose of adding an alt (or title) attribute? ALT is to add alternate text for when you have an image or an element you are using that doesn't display text, and title is basically the same thing.

    The alt and title attributes

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ALT is an attribute which provides alternate content (a text equivalent) for non-textual information. It is displayed, for instance, instead of an image, if the image is unavailable or unsupported.

    You can't have a text equivalent for text, that would be displayed instead of the text, because it defies reason.

    If you want a tool-tip 'popup' for some text, use the TITLE attribute like Rudy said. Wrap the text in a SPAN if you don't have any other, more semantical, element type on which to set the attribute.
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Enthusiast smilinjack's Avatar
    Join Date
    Nov 2004
    Location
    Wilds of Borneo And the vineyards of Bordeaux
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Adding ALt Tag text

    Could you give me a short example of that coding?

    Thanks,
    Jack
    North to Alaska !

  6. #6
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,462
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    <p title="this is a tooltip">this is the paragraph</p>
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #7
    Word Painter silver trophy
    Shyflower's Avatar
    Join Date
    Oct 2003
    Location
    Winona, MN USA
    Posts
    10,025
    Mentioned
    136 Post(s)
    Tagged
    2 Thread(s)
    the title attribute is especially useful for text links that will take the user away from the page they are reading.
    Linda Jenkinson: Content Team Leader
    Creative Web Content
    "Say what you mean. Mean what you say. But don't say it mean." ~Unknown

    March Photo Challenge. "Blue" Poll is open. Vote NOW!
    April Photo Challenge - "A Piece of Paper"

  8. #8
    SitePoint Enthusiast smilinjack's Avatar
    Join Date
    Nov 2004
    Location
    Wilds of Borneo And the vineyards of Bordeaux
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up Adding ALt Tag text

    Thanks to all for your help!

    Jack
    North to Alaska !

  9. #9
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    People get confused because IE shows the alt text as a tooltip when there is no title present. Which is wrong.

  10. #10
    SitePoint Enthusiast jeffrey.pry's Avatar
    Join Date
    Oct 2006
    Location
    United States of America
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you mean by ALT tag, that's an image tag...
    -----------------
    Jeffrey Kevin Pry

  11. #11
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lots of people say ALT tag when they mean ALT attribute.
    Birnam wood is come to Dunsinane

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
  •