Results 1 to 3 of 3

Thread: Alt Tags

  1. #1
    Join Date
    Oct 2007

    Alt Tags


    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?


  2. #2
    Join Date
    Aug 2004
    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.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Dec 2012
    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