views:

330

answers:

8

Is there any logical or technical reason (with the W3C validation) for making alt as required attribute ..

This is my actual problem:

though my page is perfect enough with respect to W3C validation rules .. Only error I am getting is

line XX column YY - Error: required attribute "ALT" not specified

I know the significance of "alt" attribute and I have omitted that where it is unnecessary .. (to be more elaborate .. I have added the image to increase the beauty of my page and I don't want alt attribute to show irrelevant message to the viewer)

getting rid of the error is secondary .. rather I am curious to know whether is it a flaw with validation rules .. ??

I thank stackOverflow and all the members who responded me .. I got my doubt clarified .. :-)

+3  A: 

I would assume the validator is playing it safe and demanding it for visually impaired and blind users who cannot see your images and thus need that information to figure out what is going on your site.

darren
yup.. thanx for response :-)
infant programmer
+5  A: 

It's required so text-only browsers, such as screen readers for the blind, know what to display. Set it to an empty string where they only are added for design purposes.

<img alt="" src="image.png">

I think Internet Explorer is the only one to display the alt in a tooltip. That is what the title is made for. So this is not a flaw in the validation rules (alt is required according to the standard), but it's a flaw in Internet Explorer.

Emil Vikström
their own **behavior**?
Chip Uni
Chip, I accidentaly hit the submit button when :-)
Emil Vikström
thanx for sharing useful information :-)
infant programmer
+2  A: 

The value of title attribute is what the user will be shown as tooltip when s?he hovers the mouse over your image. alt text will be displayed in case the image was not loaded in the first place.

EDIT: Oops, IE does show alt text as tooltip. reasonsToHateIE++
Thanks @Emil for the info.

Amarghosh
Yup I know .. its a flaw with IE ..
infant programmer
+3  A: 

I suppose some good reasons might be :

  • Technical : if the image is not displayed (be it because it's not found, or because the user is using a browser that doesn't display images), it could be great to have some alt ernative text to display instead
  • Logical : at least for uses that don't displayed images, it's nice to have some text to describe what it's about -- especially thinking about screen-readers, here


If you have some images that don't have any "useful signification" (i.e. that are here for decorating purpose, and not as any kind of content), I suppose you can just use an empty alt text.

Pascal MARTIN
ohk .. I agree with you .. Does it have anything to deal with blind people .. as like others have tried to mention?
infant programmer
Considering blind people won't be able to see the images (while they'll be able to use a screen-reader), it might ;-)
Pascal MARTIN
ohk .. that's enough to choose as best .. ;-)
infant programmer
+2  A: 

Think about blind people that can't see the images and need to hear what the images are

Tony
thanx for sharing useful information :-)
infant programmer
+2  A: 

Having a blank alt attribute is important as it says "I have no meaning for the impaired users of my site".

Usually all of my img elements have blank alt attributes, as my non presentational images are text switched with backgrounds in CSS.

This is, of course, until an SEO guru comes along and starts packing the alt attributes with keywords.

alex
yup .. thanx for the response :-)
infant programmer
+1 for the SEO bashing.
Emil Vikström
+6  A: 

from XHTML Reference:

... it is therefore important to render decorative images invisible to non-visual devices. This is done by leaving the alt attribute blank

<img src="images/border.jpg" alt="" />

All non-decorative images require alt text and the alt text must be a suitable replacement for the image in cases where the image cannot be rendered.

and

Non-decorative images can also display a tooltip when the cursor lingers over the image. The tooltip text is placed in the title attribute.

Ofri Raviv
A: 

See this video also

Google guru Matt Cutts discusses how best to optimize your site for Google using ALT

http://www.youtube.com/watch?v=3NbuDpB_BTc

metal-gear-solid