View Full Version : How to put ALT attributes on CSS classes?
bassa
11-13-2008, 03:32 PM
Hello!
I have my menu buttons and some function feature buttons that I have created through the use of CSS classes, but how do I add an alternative description to these buttons in the HTML markup (I believe that's what I need to do)?
Link here: http://www.froso.dk/test/index.html
The 'Del & Gem' button on the right hand side has an ALT description, but that's because it's a Rollover button, and I know how to create those.
Help, anyone? :)
Cheers,
Bassa
jscheuer1
11-13-2008, 05:28 PM
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:
<a href="javascript:window.print()" class="print"></a>
You could do:
<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.
bassa
11-13-2008, 06:44 PM
If you are looking for something else, please be more specific.
No John, this is exactly what I was looking for. :)
You explained it perfectly for me, and have provided me with a solution to my problem, and for that I thank you!
Cheers,
Bassa
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.