Front-End Quiz Part 8, ALT Attributes


For a propane supplier's website, which use of the alt attribute value is best?

  1. <img src="mountains.jpg" alt="mountains.jpg">

    This provides no useful information in cases where the image can't be seen.

  2. <img src="mountains.jpg" alt="mountains.jpg, 400x300, jpeg image">

    This provides no useful information in cases where the image can't be seen, and adds noise to the page's content.

  3. <img src="mountains.jpg" alt="aren't they pretty?">

    Aren't \*what\* pretty? By definition, the user can't see the image if the alt text is showing.

  4. <img src="mountains.jpg" alt="mountain scene">

    If the image were followed by the text "We can deliver propane to your door seven days a week." then the text "mountain scene We can deliver propane to your door seven days a week." would be displayed when the image wasn't present, which would be weird.

  5. <img src="mountains.jpg" alt="a mountain scene, taken March 2004, near Evergreen CO">

    If the image were followed by the text "We can deliver propane to your door seven days a week." then the text "a mountain scene, taken March 2004, near Evergreen CO We can deliver propane to your door seven days a week." would be displayed when the image wasn't present, which would be weird.

  6. <img src="mountains.jpg" alt="We Are Colorado's Best Propane and Natural Gas Supplier.">

    This is good, possibly, depending on context. Alt text doesn't necessarily need to reflect the content of the image! It's truly ALTernative content. If the image were followed by the text "We can deliver propane to your door seven days a week." then the text "We Are Colorado's Best Propane and Natural Gas Supplier. We can deliver propane to your door seven days a week." would be displayed when the image wasn't present, which would be a great use of alt="". However note that context and intent should be taken into account when deciding alt text, and it's certainly not something that's machine-decidable.

  7. <img src="mountains.jpg" alt="">

    This is iffy. Sometimes it might be best to leave the alt attribute blank.

  8. <img src="mountains.jpg"> (no alt attribute)

    This is bad. There should always be an alt attribute, even if blank. This at least makes it explicit that the image adds no meaning to the page.


Comments:

Post a Comment:
Comments are closed for this entry.
About

My name is Greg Reimer and I'm a web technologist for the Sun.COM web design team.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today