I use hover, active and disabled to style Buttons.
But the problem is when the button is disabled the hover and ac
A lower-specificity approach that works in most modern browsers (IE11+, and excluding some mobile Opera & IE browsers -- http://caniuse.com/#feat=pointer-events):
.btn {
/* base styles */
}
.btn[disabled]
opacity: 0.4;
cursor: default;
pointer-events: none;
}
.btn:hover {
color: red;
}
The pointer-events: none
rule will disable hover; you won't need to raise specificity with a .btn[disabled]:hover
selector to nullify the hover style.
(FYI, this is the simple HTML pointer-events, not the contentious abstracting-input-devices pointer-events)