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?
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?
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.
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.