CSS on Mouse Down

Posted by danixd on Stack Overflow See other posts from Stack Overflow or by danixd
Published on 2010-04-27T21:57:35Z Indexed on 2010/04/27 22:03 UTC
Read the original article Hit count: 362

Filed under:

Usually I would use :hover, but I want my website to be accessible on touchscreen media too.

I know I can use :active, but as soon as I let go of the mouse button, it goes back to its inactive state.

Effectively I want:

Mouse Down : Div goes green

Mouse Up: Div stays green

Mouse Down: Div goes red

Mouse Up: Div stays red

Instead of:

Mouse Down: Div goes green

Mouse Up: Div goes red

© Stack Overflow or respective owner

Related posts about css