The keyboard controls the movement of the div. Why is it much faster to move to the right than to the left? Going down is much faster than going up?

        var oDiv = document.getElementById("div1"),
            ev = ev || event;

        document.onkeydown = function (ev) {
            var pos=getPos(oDiv);
            switch (ev.keyCode) {
                case 37:
                    oDiv.style.left = oDiv.offsetLeft - 10 + "px";
                    break;
                case 38:
                    oDiv.style.top = oDiv.offsetTop - 10 + "px";
                    break;
                case 39:
                    oDiv.style.left = oDiv.offsetLeft + 10 + "px";
                    break;
                case 40:
                    oDiv.style.top = oDiv.offsetTop + 10 + "px";
                    break;
           
            }
        }
        
        
  divrelativeabsolute.....?   
  ,position:relative,bodymarginpadding0,~o()o
     
Mar.02,2021

took a look. It seems to be the reason why style.left and offsetLeft are not equal.
you should have no problem setting the inner and outer margins of the parent element to 0.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b404e7-40a8d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b404e7-40a8d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?