Can the alt attribute for an img tag be empty?

Alt tags also help in SEO. That is one more reason to have them.

Sorry, but that interpretation doesn’t work. The specs do most definitely allow an empty attribute where that is appropriate.

If an image has no alt attribute at all, user agents that can’t display the image won’t know whether that’s because the author doesn’t want the people to be told of the image or is just ignorant and has missed off the alt attribute - so they play safe, and announce the image. They may do this by simply saying “image”, or they may announce the filename, or both.

By specifying an empty alt attribute, the author is explicitly saying “there is an image here but it is not essential to the page, so user agents that can’t display the image should ignore it”. That is a valid and useful option to have, and conveys more information than simply omitting the alt attribute altogether.

There is no such thing as an <alt> tag in HTML or XHTML.

And I doubt that alt attributes make much difference to SEO since they have been spammed to bits by clueless SEO ‘experts’ for years. The only case where they may count is for image searches.

Anyway, what do you suggest one should use as a text equivalent – for ‘SEO’ purposes – for an image that doesn’t convey any relevant information in the context where it’s used?

  1. There is no such thing as an alt tag.
  2. If the images support the text then the relevant words will feature in the text content, so little if any value will be added by repeating them in the alt attribute.

The SEO benefits of alt text are minimal, and should not be seen as a reason to go against good practice.

it is important for seo

Do you have any proof of that?

And I repeat the question I asked of csspisces who claimed the same thing:

What do you suggest one should use as a text equivalent – for ‘SEO’ purposes – for an image that doesn’t convey any relevant information in the context where it’s used?

If you don’t post a believable reply to this I’m forced to conclude that your post was nothing more than an attempt to gain visibility for your signature links, which is a violation of the forum guidelines.

if you put alt in your images. google will be easily crawl in image search. if you have try it in your site.

Right. I said as much in post #44.

Now, the question is: would the average site owner want his/her images to be easily found by search engines? If you’re a photographer or graphics artist, then yes, of course. But if you have a stock photo image as an eye-catching accompaniment to your article?

And please give some concrete examples on a suitable text equivalent for a mainly decorative image, which would be beneficial for SEO without being detrimental to accessibility.

Well I might be tempted to put the following…

Image 1 (The pigs)

Two pigs representing meat under localised export bans.

Image 2 (The vans)

Van’s couriering mexicans in china to a homebound charter plane

Alex, those text fragments would probably confuse the heck out of me if they appeared in the middle of an article text, e.g., on my mobile or in Lynx.

Really? Based in the document flow of that particular site it would read as…

Alt = Two pigs representing meat under localised export bans.

Text below = Mexico argues there is no way of getting swine flu through eating pork

and…

Alt = Van’s couriering mexicans in china to a homebound charter plane

Text below = Chinese authorities are taking no risks with the quarantined Mexicans

It made sense to me (as reading) but meh :stuck_out_tongue:

If the image is a floated first child of the paragraph (which isn’t unlikely), lynx will render it as,

Two pigs representing meat under localised export bans. Mexico argues there is no way of getting swine flu through eating pork

If the image is in a standalone block element preceding the paragraph there will be a line break between the sentences. In either case it looks like a non sequitur to me.

If the image is wrapped in a heading, then it might work.

Those are descriptions, not text alternatives. You are saying what is in the photo, not conveying the same information via text. The pictures don’t convey any information in themselves in that context, they are just decorative additions to the main text. Therefore, they should have empty alt text.

Man, recovering from a cold… : (

Pew, what nasty nasty code on that page! I was also thinking of every time I heard “link graphic” and didn’t realise it was completely skipping empty alts if they weren’t in a link. I grabbed one of my pages and filled with a bunch of images. I tried alt=“nothing in English”, alt=“something in English” to get my bearings (it’s very hard to listen to Dutch pages with an English-only machine) and then alt=“” and no alt at all.

I wonder, if I shell out the arm and the leg, if I can get JAWS to read in Dutch… my copy of 10 came without any languages at all, while 7 came with a few (but not Dutch). It mangles everything terribly, I can’t tell where I am, and in the past have had to translate whole chunks of text to Engrish for JAWS testing : (

How so? Especially given that they have little weight to begin with? They’re an assistive device that provides a textual equivilent of the image for those who cannot see them. If the search engines are going to use the attribute (and they do), it’ll be for determining the relevance of the image to the content that surrounds it and (as Tommy already said) image searches.

Besides, even Google’s own Matt Cutts says to use the attribute the way it was intended “and not for SEO purposes” if you really want to optimize the IMG element (and its alt=“” attribute) for the search engines.

I would have thought alt text would be given the same weight as the text around it, for SEO purposes (ie, pretty low weight in most cases). That is the whole point of it after all!

It should be, but since it was spammed to death early on, I thing search engines regard the alt attribute with some scepticism.

Not if the alt attribute says the same as the text in the image. (I’ve had it verified by someone at Google that Google views alt attributes in links pretty much the same as plain text.)

I as well have heard the same thing and come to believe it…

My two cents worth:

Alt attributes should be filled in with a proper description that hopefully contains yuur keywords for two reasons. One is that it will help search engines get to know what your page is about and the second is that it will help your image get indexed in images sites like google images. Traffic, you know.

And the consequence that screen reader users, mobile users, dial-up users and others are subjected to completely irrelevant rubbish doesn’t bother you at all?