开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜