ALT & Title for images in CSS stylesheet?

Discussion in 'CSS' started by Pixelrage, Mar 6, 2008.

  1. #1
    Is it possible to declare ALT or Title for an image in CSS? For example, if I have this in my stylesheet:

    ...I'm guessing there's no way to add an alt="Alt goes here" or title="Image title here"?
     
    Pixelrage, Mar 6, 2008 IP
  2. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nope. It's a background image, which means it's purely decorative like a border or a round corner. Only content gets "alternative text" to say whatever the image is saying.

    That said, my personal opinion is that 99% of images are presentational (decorative) anyway. If you've got an article about your cat and you have an image about your cat, anything that you're intending to tell your audience about that cat should be in the main text anyway.
    I consider things like charts, diagrams, and how-to instructive images as truly having content.

    I'm in the minority with this opinion though. My advice is that if these background images are trying to be served as content, add whatever the alt text would be in the text content somewhere OR maybe you are using proper image replacement (where an image has text on it like a logo... in which case that image should be sitting on top of the real text so the text is there when the image isn't (or can't be seen).
     
    Stomme poes, Mar 6, 2008 IP
  3. CaffinePhil

    CaffinePhil Banned

    Messages:
    945
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So would a page banner be seen as decorative or would you place this in the html?
     
    CaffinePhil, Mar 7, 2008 IP
  4. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If it's a clickable banner, the easiest thing is to have it in the HTML since it's pretty much content (a link to another site). It also has a direct, specific message to communicate--- so let's add that to my list of images that are truly content : )

    In which case, if it's a link-banner, the alt text should say what the banner says or at least "Advertisement for SoAndSo.com"... if it's not a link, but still a banner for another site, the alt text should prolly also say the web address of the company.
     
    Stomme poes, Mar 7, 2008 IP