It's a little unclear what you mean, but that's probably not your fault. The alt attribute is only for images (not background images, also can be used in image maps). It is intended only to be seen when the image cannot be rendered. However, IE will display this text as a sort of tool tip when the mouse is over the the image if the image doesn't have a title attribute. So people familiar only with IE often get title and alt confused.
The title attribute can be used with links and a great many other things including images, spans, divisions, etc. It has nothing to do with anything not being rendered, but is specified to display a small tool tip type thing in most browsers.
If that's what you want, where you have something like this:
Code:
<a href="javascript:window.print()" class="print"></a>
You could do:
Code:
<a title="Print this Page" href="javascript:window.print()" class="print"></a>
If you are looking for something else, please be more specific. One thing I can tell you though, as I say, there is no alt for background images. So if a background image is missing or cannot be rendered, there can be no substitute text automatically there to replace it. With clever markup and style, some text may be able to be left underneath it in case it doesn't render. If you need a true alt though, the best thing is to use an actual image tag.
Bookmarks