Jump to content

CSS Image Sprite with OnClick?


dibigid

Recommended Posts

Pretty straight forward question I think... I'm redesigning my website buttons to use an image sprite. I can get them to display the normal image from the sprite, as well as the :hover image, but I'm having no luck finding a way to get the button to change appearance when you click on the button (not in the new page, but the actual "onclick"). Is this even possible with an image sprite and CSS or would I need to implement something else? I've found absolutely nothing on the internets related to this. Thanks!

Link to comment
Share on other sites

You need Javascript events to detect clicks. In some browsers, the :active pseudo-class works with CSS, but in others it switches back as soon as the mouse button is released. I'm not sure which is the standard way now, but I wouldn't rely on that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...