CodeBreaker
CodeBreaker

Reputation: 564

On click remove hover style until next time element is hovered

There's a button that changes color when a cursor hovers over it.

Example jsfiddle: https://jsfiddle.net/xftbqku3/5/

I wish to have an effect that goes like this: When the button is clicked, disable background-color css rule until the next time it is hovered over.

In other words, when I click the button, I want it to show the button color (red or green) and not the hover color until the next time I hover over it.

Is it possible to to this with just css?

Upvotes: 0

Views: 624

Answers (1)

Servus
Servus

Reputation: 517

I am not able to comment(not enough reputation). But maybe you can try using <input type=checkbox> and in css input:checked

Upvotes: 0

Related Questions