www.webdeveloper.com
Results 1 to 3 of 3

Thread: Alt Tags

  1. #1
    Join Date
    Oct 2007
    Posts
    154

    Alt Tags

    Hi,

    I'm trying to add unique alt tags to my php code that reads images from a directory.
    Is there a way to add alt tags without adding each image to a database with an "alt" column?

    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,148
    As long as you have some other way to determine what the alt tag's value should be, then sure. Without knowing what you really mean by "unique" alt tags, I can't really suggest anything off-hand (uniqid()? md5() hash of the file name? The current UNIX timestamp concatenated with the phase of the moon? )

    PS: an empty string is a valid value for an alt tag, if you don't really have anything in mind for it and just want your HTML to be valid.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Dec 2012
    Posts
    52
    The alt attribute is an attribute of the img tag and is meant to be an alternative for non-visual browsers when they come across images. This means, that the text is meant to be used when the image is not visible on the page. Instead, what is displayed is the alternative text.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles