CSS This is because of margin: 10px; at #btn
EDIT
If you use onmousedown rather onclick , it will work.
Clarification:
The pseudo-class is activated before onClick. If you change: active from 2px to 20px. You will see this even if you click on the middle of the button.
So, after the new left and top values set with: active, the mouse is no longer on top of the div and cannot register a click ( press and release ).
onmousedown , .