mounty — 2009-04-27T17:24:54-04:00 — #1
I believe the img tag requires the alt attribute to validate the markup, but is alt allowed to be an empty string?
My validation tool seems to think it's ok, but I always thought it was required incase the image was missing
alexdawson — 2009-04-27T17:31:36-04:00 — #2
It can be empty, but you should always try to provide alternative text unless you have a seriously good reason not to do so. Be warned that by excluding a complete alt tag, visually impaired users will be unable to know that you have a picture in that placement.
mounty — 2009-04-27T21:36:12-04:00 — #3
ok then fair enough
felgall — 2009-04-27T22:06:19-04:00 — #4
Usually an emtyp alt attribute indicates that the image is purely decorative and ought to be added by the CSS rather than the HTML. Those in the HTML are usually there to convey some information and that information would need to go in the alt attribute for those who don't see the image.
autisticcuckoo — 2009-04-28T01:47:03-04:00 — #5
alt attribute provides the text equivalent (alternative) for an image. In other words, it should convey the same information as the image does (in that context).
If an image doesn't convey any relevant information in a particular context, the text equivalent should be empty. Thus,
stomme_poes — 2009-04-28T04:58:38-04:00 — #6
Be warned that by excluding a complete alt tag, visually impaired users will be unable to know that you have a picture in that placement
They would know it's there if they have a screen reader. It'll say "graphic".
On a current site I've found myself using alt="" quite a lot. The reason being, background images can't be floated, where the text wraps around it, but the images are definitely decoration. Are there any good tricks for moving these things into the CSS?
autisticcuckoo — 2009-04-28T06:52:20-04:00 — #7
Not really. You could have an empty floated div and set the image as a background on that, but what would be the point?
simon14593 — 2009-04-28T07:09:52-04:00 — #8
In a nutshell, alt tags are not important for validation, however, they are very important for both accessibilty and SEO.
autisticcuckoo — 2009-04-28T07:21:13-04:00 — #9
Please, people, it's an
alt attribute, not an
<alt> tag. :-/
simon14593 — 2009-04-28T07:27:53-04:00 — #10
LOL. Good point. Alt attribute was what I meant.
autisticcuckoo — 2009-04-28T07:30:31-04:00 — #11
My comment wasn't directed to you personally, Simon. Too many people use the same misnomer, even people who allegedly are professionals. It's as if a medical doctor would refer to the heart as a gland.
alexdawson — 2009-04-28T10:59:51-04:00 — #12
Well mine swells and excreets stuff every second of every day!
I know it is an attribute rather than "tag" but I was still half asleep when I wrote it
dan_schulz — 2009-04-28T13:59:36-04:00 — #13
I use empty SPANs for that on the rare occasions I actually need to use them.
blake_tallos — 2009-05-02T09:28:51-04:00 — #14
Hahaha, I swear it gets better everyday tommy.
Examples of Attributes -
Good point though. It really is important to learn the differences because if we didn't what would be though point right?
devbanana — 2009-05-02T09:43:13-04:00 — #15
Not at all true if the alt attribute is empty. It will say nothing.
autisticcuckoo — 2009-05-02T12:40:27-04:00 — #16
Yes, but the question was how screen readers handle an omitted (i.e., missing, not existing-but-empty)
devbanana — 2009-05-02T12:57:14-04:00 — #17
Same as if it is empty. I thought someone believed it would say something when encountering an image if it had an empty alt attribute. But whether it is empty or non-existent altogether, it will be as though the image is not there.
autisticcuckoo — 2009-05-03T12:23:39-04:00 — #18
I've heard a screen reader (may have been Window-Eyes, not sure) that would spell out the image URL (after saying the word 'image') in the absence of an
alt attribute. That was a few years ago, though, so perhaps newer versions ignore it.
devbanana — 2009-05-03T13:08:13-04:00 — #19
In JAWS (which is what I use), it has an option to do that, but by default it reads the alt attribute and ignores it otherwise.
The only time it'll read the URL is if the image is within a link. But if someone neglected to put in an alt attribute, it is often the case that the image has a cryptic name as well, so it reveals no more information about the target of the link.
For instance, on this page, the five links after the logo have no alt attributes, so I hear something like this:
Link graphic ss/sapphiresteel_pagegfx_r2_c4 On mouse over
Link graphic ss/sapphiresteel_pagegfx_r2_c5 On mouse over
Link graphic ss/sapphiresteel_pagegfx_r2_c7 On mouse over
Link graphic ss/sapphiresteel_pagegfx_r2_c9 On mouse over
Link graphic ss/sapphiresteel_pagegfx_r2_c11 On mouse over
Luckily, not all of their links are like that.
kikykuang — 2009-05-05T05:52:38-04:00 — #20
I think you should not empty
next page →