tags:

views:

25

answers:

2

Hi. I am trying to display sets of images with up and down navigation in form of arrows. I have added

cursor:pointer;

to the arrows on hover to emphasize the clickability. However, when there is no more images in a certain direction, i set the class to disabled.

.disabled
{
    cursor:default;
}

However, the hover pseudo class takes precedence here, and changes the cursor to pointer. How can I prevent :hover to set the cursor to pointer when .disabled is set? Is it at all possible?

+2  A: 

Add also

.disabled:hover {
   cursor: default;
}
KennyTM
Worked perfectly! Thanks man.(accepting answer when I can, some time limit)
Max Malmgren
+1  A: 

Use !important.

.disabled {
    cursor:default!important;
}

IE6's !important implementation is buggy, so if you need to support it you might just be better off re-ordering your rules to get the required precedence for the .disabled class.

David Dorward raised an interesting point to note in the comments. Applying a value to cursor in a :hover pseudo-class is completely redundant. The following to rules have exactly the same effect:

.mylink { cursor:pointer; }
.mylink:hover { cursor:pointer; }

Therefore, you should avoid setting cursor in a pseudo class and stick to

.mylink { cursor:hand; }
Andy E
IE6 does support !important (although there are some bugs relating to it) and `hand` is invalid CSS. (That said, !important is a one-use sledgehammer and is almost always the wrong answer (the right answer being "Get your specificity straight")
David Dorward
You provided more info so I accept this as the answer.
Max Malmgren
@David: you're quite right, I forgot that `hand` was a MS proprietary value for *cursor*. I do agree that re-ordering rules is usually the better solution. Thanks for the corrections.
Andy E