Forum Moderators: not2easy

Message Too Old, No Replies

CSS Image Rollovers with Classes

Having trouble creating CSS image rollovers with classes instead of IDs

         

krhmt52

7:18 pm on Oct 13, 2006 (gmt 0)

10+ Year Member



I am trying to create a CSS image rollover effect (like the one described on Simple Bits (found at h ttp://www.simplebits.com/notebook/2003/09/30/accessible_imagetab_rollovers.html).

The list elements I am using will be repeated several times on the page, with the only difference being the images used for the rollovers. Thus, I was trying to change the #nav elements in the SimpleBits example from IDs to classes (.nav instead of #nav). Things work fine with the #nav notation, but by only changing the CSS (and corresponding XHTML) to .nav, the rollover effect stops working.

Why is this?

I have separate ID elements for the individual list items, so that's all I want to change. Why should I have to repeat the other styling/positioning code for nav element, when the only piece changing is the image used? I just don't get it. Is there something about class vs. ID that prevents the rollover?

Any help is greatly appreciated.

Fotiman

9:11 pm on Oct 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Can you post your code please?