Results 1 to 3 of 3

Thread: How to put ALT attributes on CSS classes?

  1. #1
    Join Date
    Apr 2008
    Posts
    109
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default How to put ALT attributes on CSS classes?

    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

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    bassa (11-13-2008)

  4. #3
    Join Date
    Apr 2008
    Posts
    109
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •