It seems that :active
only applies a background
color at the instant when you have clicked on the <button>
in the interim between click release. I basically would like to apply , if it exists, a pseudo-class that is invoked after the release of a click on a <button>
element to demonstrate to the viewer that it has been toggled.
button:active{
background:#FFFFFF;
}
UPDATE:
I changed the <button>
to be an anchor tag. However, when I try
#button-id:visited{ background:#FFFFFF; }
It doesn't render the background color after I click the <a>
Here is the Fiddle:
https://jsfiddle.net/y5apt5et/
Here's a list of all CSS pseudo-classes. There's nothing that works as a toggle button. Your best bet is to add an event listener that listens for a click on the button and adds or removes a class that represents being toggled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With