Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use alt='' for every img tag??? even for whitespace? 1

Status
Not open for further replies.

spewn

Programmer
May 7, 2001
1,034
i have this code:

Code:
<img src=img/spc.gif width=1 height=1>

according to this w3 validator, i should put alt tags in each of these, if so, would it benefit me to make them all the same name, such as:

Code:
<img src=img/spc.gif width=1 height=1 alt='donuts'>

let me know why!

- g
 
alt [red]attributes[/red]

for spacers just use alt="", for linked images use the alt attribute as anchor text and describe the target page, For unlinked images the alt attribute should be a sentence describing the image.



Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
You put alt tags in for the benefit of people who can't see your images. Not for pointless keyword stuffing. "alt" is short for alternative text.

A blind person visiting your site with a screen reader will have the presence of an un-alted image announced to them - they have no way of knowing what it is or whether it's important. If it's a piece of eye-candy or (heavens - is it 1998 again?) a spacer gif, the correct value to use is [tt]alt=""[/tt], then the screen reader will know to ignore it.

If it's a image used to present a heading, say, in a particular fancy font, you should put whatever the text says into the alt attribute:
Code:
<img src="logo.gif" alt="Tek-Tips Forums">
That will also ensure that search engines can read it - remember Google is blind too. If you want to stop the [tt]alt[/tt] text being displayed in a tooltip in IE, add [tt]title=""[/tt] to the tag too.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
A blind person visiting your site with a screen reader"
Or even a text browser, as is common among old geeks and tech heads with web-enabaled cells, watches, shoelaces and the like. In general if the image is the "anchor text", there should also be a nearby text link with meaningful text (both for navigation sake and for searchability).

[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top