I have a div that I want to center so I use
margin-left: auto;
margin-right: auto;
position: relative;
That's the easiest way to center I admit, but when I want to use event.pageX and event.pageY it takes the coordinates plus the left margin and that's wrong.
Here is the fiddle. Click somewhere on the green rectangle to watch the result :
Any ideas how to fix so to show the square to the coordinates without the left margin ?