|
|||||||
| HTML Discussion and technical support for building, using and deploying HTML sites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Ugh! Why is this attribute so darn important in my IMG tags?
I just started validating my website which I have never done before and I get all these errors due to missing ALT attribute. So I slap in alt="" and it is happy. I really didn't define the function of the image, I just stuck the tag in there with an empty definition to get validated. It just makes me question why validating is so important. Nothing I ever change makes the site look different or work different. The only reason I am changing things is just to get some sort of "approval" thing.
|
|
#2
|
||||
|
||||
|
Because sometimes images don't load, and also so your page makes some sense to text browsers
|
|
#3
|
||||
|
||||
|
Quote:
Of course, you can cheat and just do a global search-and-replace on "<img" with "<img alt=''", but that doesn't help any users who visit your site in a non-graphical browser.
__________________
"That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett freelancer.internet.com Email me |
|
#4
|
|||
|
|||
|
OK, so I do want a site that is user friendly for all. But I am still puzzled as to what I should put in these alt attributes that would aid such browser users.
|
|
#5
|
||||
|
||||
|
A simple description of the image would do. If you had a picture of a dog, you could put alt="dog". You can be more descriptive if you wish and put "brown dog jumping over a fence". Whatever you think would convey your message to a person that can't see your images for whatever reason.
|
|
#6
|
||||
|
||||
|
For each image, just consider what information it conveys to the user, if any. If it is purely decorative, it's probably OK to just have an empty alt="" attribute. If, for example, it is used as a link, then the alt text should describe (breifly) what it links to. From http://www.w3.org/TR/html4/struct/objects.html#adef-alt :
Quote:
__________________
"That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett freelancer.internet.com Email me |
|
#7
|
|||
|
|||
|
Great advice everyone! Thanks!
|
|
#8
|
|||
|
|||
|
reviving an old topic...
I am conflicted with including ALT tags where not needed. For example, lets say you use a spacer transparent gif or an image that has no value other than artistic - versus say a button image you would clearly want to ALT tag, when validating it wants you to add an ALT tag to these types of images that have no value having said tag.. I don't want to or need it as it provides nothing for that type of image. In doing so, it seems to be that having several iterations of an empty ALT ="" creates dirty & bloated code versus no ALT at all, so I would rather not have it.. but cannot 100% validate without it. |
|
#9
|
||||
|
||||
|
Quote:
Any image that doesn't need an alt description should also be added to the page as a background from the CSS rather than being in the HTML. The HTML should only contain the real content of the page (including alternative text descriptions of all the images that describes the purpose that they serve in being in the page). Spacer images and other "artistic" images create dirty bloated HTML when you use them and should be completely deleted from there and the correct CSS used in their place.
__________________
Stephen Free Computer Help, blog, forum Web design ebooks and software JavaScript scripts and tutorials Last edited by felgall; 12-17-2008 at 08:24 PM. |
|
#10
|
|||
|
|||
|
yes, i was just making the point.. forget about the spacer..
lets say I use an image as a border edge along the bottom of a page. it is a nice artistic touch that caps off the bottom edge and is only a mere 1 pixel tall. no value to adding an ALT tag to it.. and, relative to bloated coated.. it seems it takes more actual code KB to write the css style then it does to just include this image in the actual pages code as there, all you are doing is calling an image while in a css you are writing the style, placing the style in the page code, calling the style, parsing the style, and still displaying the image.. that seems more 'bloated' code than just placing the image in the page. |
|
#11
|
||||
|
||||
|
Please read the section from the spec that was quoted by Mr. NogDog.
__________________
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.” —Tim Berners-Lee, W3C Director and inventor of the World Wide Web |
|
#12
|
||||
|
||||
|
Quote:
Well, it fact it is not like that. Images in CSS background are loading faster. One of the reasons is that CSS is loaded first, as the code is placed in the HEAD section. Definitely CSS way has only advantages.
|
|
#13
|
||||
|
||||
|
On the other hand... Why do you feel so angry that you need to use ALT for images? Is it so hard to keep the accessibility of your page?
|
|
#14
|
|||
|
|||
|
certainly not 'angry' about anything.
I look at it in terms of pieces of code.. which adds up to KB.. so, if the ALT tag is not conveying any info, why include it? it is an empty tag so why even include the 5 extra characters of ALT""? that, to me, is bloated. and, no "accessibility" is lost or gained by ALT tagging images that have no value. Like I said, and like NogDog quoted the obvious, on links or buttons or images that contain info of value ALT tags make sense... but on some images on the page they have no value so why even include an empty tag? |
|
#15
|
||||
|
||||
|
If the alt attribute is empty then the image should either be part of the background or not there at all. The HTML should only contain the content of the page and not anything that relates purely to its appearance - CSS is where you define the way the page looks.
Any image entered in the HTML that is genuinely part of the content and belongs there will never have a blank alternative text since the alternative text is the equivalent text cotent to what the image means when it shows in the page.
__________________
Stephen Free Computer Help, blog, forum Web design ebooks and software JavaScript scripts and tutorials |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|