domino
domino

Reputation: 7345

Button goes back to original style after click instead of staying active

Basically I have two three styles for a button: normal, hover and active.

Once the button is clicked I want it to stay with the active style instead of going back to normal for a brief moment before the page loads. Can this be done with css or do I have to do it with jquery?

Upvotes: 0

Views: 1020

Answers (1)

BoltClock
BoltClock

Reputation: 724302

You could use the :focus pseudo-class instead of :active, as :active only applies as long as the mouse is down on an element, whereas clicking on said element will give it :focus until that focus is transferred elsewhere (like another button on your page, or another window entirely).

Upvotes: 4

Related Questions