tags:

views:

21

answers:

2

I see this site that has a button, when I hover over it the background changes.

When I click on the button, the button shading inverts i.e. reacts to the click event.

Which CSS style is this? I know :hover is for hover, but what about a click?

+3  A: 

CSS does not handle events.

You're looking for the :active pseudo class, which is only for the A-tag, not buttons. You can style A tags to look like buttons as well though.

See: http://w3schools.com/CSS/css_pseudo_classes.asp

Diodeus
A: 

What you're looking at is the browser's default styles for the :active pseudo-class, which also applies to keyboard input on a button (try tabbing to it and pressing the spacebar).

These pseudo-classes do NOT just apply to the anchor element, it's a common misconception caused by old versions of IE not supporting them on anything other than the anchor element.

Chris Cox