Can I use css3 or css to swap a icon on a button
Right now I have a button with a span in it, I would like to have the abilty when the button is clicked that the span's bg will change and stay changed.Is this possible ? And yes I know I can use javascript for this b开发者_如何学JAVAut I would like a pure css solution if possible
If it was a link (<a>
) you could try using the :visited
selector, but since buttons aren't links, there's no pure CSS that'll do this for you.
If you can style an <a>
to look like your button, and then you could use the selector:
a.fakebutton span {
background: ....
}
a.fakebutton:visited span {
background: something else;
}
I'm afraid you wont be able to achieve this without client-side scripting.
精彩评论