This time, I am curious in regard to "title" and "alt" attributes: is there any written or unwritten "rule" on which elements to use them ?? I mean like to use them only on links (or only on graphics, read on) etc., since for instance IIRC, most folks use only the "alt" one on the graphics. thanks, tayiper
Well the alt attribute is actually a required attribute on the <img> tag. So you should use that attribute on those tags. As far as the title attribute, I have never really used it. I am sure the_pm has the technical reason
as posted above, alt is used with images, for example: when you place your cursor on the image a little pop up shows the word 'image' i have used title tags for text links, for example: when you place your cursor on the link, you'll get a little pop up that says 'this is what it is' hope that helped
The HTML 3.2 specification mentions "alt" as a valid attribute for <img>, <applet> and <area> (in <map>). According to MSDN, IE also supports <object>, <input> and <input type=image>. Hope that answers your question.
This is not really 100% true the alt is simply ment as an alternative to and object such as an image for when it is not possiable to display the image. This is why it should always be used, this is for accessablity reasons so people know what it is whith out seeing the image just of the alternative text. It is only IE that uses it to display with the mouse over, if you check in other browsers the alt attribue wont displat on mouse over, that is what the title attribue is for. So the title tag is use to display a text with a mouse over where as the alt attribute is only meant as an alternative for when something carnt be displayed as intended. Like when images are turned of and such.
well, i guess you can teach an old dog new tricks, i started using firefox several months ago and never really used an alt tag, just tried it and it won't work in firefox for images, so i tried the title tag and it works fine. i also placed title tags in text links and it works fine in firefox. thanks for correcting me.
My pleasure matey. Thats the joys of using forums like this, there is such a weath of infomation between all the users that you are always learning so much and if you ever need help with something, there is a good chance that somebody has the answer.
The alt attribute does not create a tooltip on mouseover. That IE does is contrary to the specs. Firefox follows the rules. Since the alt attribute should not cause a tooltip, and because it is annoying, you can stop IE from popping one up by using the title attribute with null content, eg. <img src="some.png" alt="blue flower in field" title="" />. cheers, gary
Hehe, and what then IE displays in case of an "img" element with both attributes, i.e. with "title" and with "alt" one; maybe two separate tooltips ?? Yeah, I assumed it is something like that. However, I already know that the "alt" one is used for the accessibility reasons (an alternative text, for instance for screen-readers, for people with disabilities etc.), but I was curious about various other elements. For example for the"title" attribute in partuicular, I've even seen it used inside the head tags; particularly in the "link" element referring to the extenral stylesheet-file. So like in this example: <link rel="Stylesheet" href="style.css" type="text/css" title="default"> Code (markup): tayiper
That is so you have assigned it a name. If you have the web developer toolbar for firefox click on CSS, go to disable styles, then go disable styles and it will list the styles sheets by the name you have assigned in the title tag. If you dont use the title attribute it will just give the URL of the stylesheet instead. That is one place where it is use I am sure there will be a few.
No, the title attribute's presence will suppress the alt tooltip. See my post just prior to yours. cheers, gary
I always put both alt and title parameters in my img tags... that way all browsers get the mouseover text coming up.
Just by putting title it will do that too. But what it wont do if you only use the title attribute is show alternative text if the image or object carnt be showen for some reason, that is why you should always use the alt attribute for accessiablity reasons. Then the title tag is for your mouse-over effect if you want it.
Well since you asked ( ), I'll mostly echo what others have said and I'll try to insert an original thought or two as well. Alternative text is just as it sounds - it is text that serves as a suitable replacement for an object if that object were to fail to load. There are times when you don't want to use alternative text as an attribute, because the context of the missing object is explained through other devices. For example, if you had an image of you and your dog, and the very next item on the page was a heading tag that said "This is Paul and his dog fluffy," you would want the alt attribute to be blank within the image tag, because otherwise you'd have redundancy from a functional perspective (someone "viewing" the page with a screen reader would not be impressed, nor would someone browsing with images turned off). Title text supplements an object. It cannot be required reading; you don't want to create objects that don't make sense unless the title text appears, because interacting with those objects is an optional end-user activity. So titles do not replace objects - they embellish them. Frankly, I've never been terribly impressed with titles, since the end user cannot control how long they remain, and there is no style recourse (which is paramount to accessibility), at least none that I've ever seen - there might be within working draft specs.