Method 1
The problem with your code is that you select .remode_hover , which is a descendant of .remode_selected . So, the first part of your code to work correctly is to remove this space.
.reMode_selected.reMode_hover:hover
Then, so that the style does not work, you must override the style set by :hover . In other words, you need to contrast the background-color property. So the final code will be
.reMode_selected.reMode_hover:hover { background-color:inherit; } .reMode_hover:hover { background-color: #f0ac00; }
Fiddle
Method 2
An alternative method would be to use :not() as indicated by others. This will return any element that does not have the class or property specified in parentheses. In this case, you put .remode_selected there. This will target all elements that do not have a class .remode_selected
Fiddle
However, I would not recommend this method because it was introduced in CSS3, so browser support is not perfect.
Method 3
The third method is to use jQuery. You can target the .not() selector, which will be similar to using :not() in CSS, but with much better browser support
Fiddle
Cody Guldner Apr 24 '13 at 20:58
source share