Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS click effect

Tags:

css

enter image description hereenter image description here

I made this thing with javascript to increment/decrement an input field. It has a hover state but it lacks a click state.

Is there a neat way to make a click state using only CSS?

E.g. darken the background slightly more for 0.1 sec on each click.

Browser compatible solutions preferred but not required.

like image 267
pjmil Avatar asked Aug 20 '14 00:08

pjmil


1 Answers

I believe the :active pseudo class is what you are after:

http://www.w3schools.com/cssref/sel_active.asp

A 0.1 sec delay could be achieved using CSS3 transitions, however using jQuery would be simpler and work across more browsers.

like image 156
ioseph Avatar answered Oct 05 '22 01:10

ioseph