I'm having trouble styling button with :focus
and :active
psedo classes.
I have certain properties defined for :focus
that I dont want to apply for :active.
HTML
<button>
When focused, my bgcolor turns red!<br />
But when clicked, where my bgcolor turns #b0bfc6
</button>
CSS:
button { font-weight: normal; color: black; }
button:focus {
background-color: red;
text-decoration: underline;
}
button:active{
background-color: #b0bfc6;
}
fiddle:https://jsfiddle.net/ph16qjx2/
As you can see in the fiddle, when I click it the button turns to a grey bg, but also takes the property defined for :focus
(which is text-decoration: underline; background-color: red
)
how can I prevent the properties defined for :focus
from getting applied on :active