Why is this not working ? pushing a box using mouse pointer

后端 未结 4 1262
旧时难觅i
旧时难觅i 2021-01-28 16:23

I\'m a beginner in Javascript, and trying to make a simple script that pushes a box using the mouse pointer. But unfortunately it isn\'t working for some reason, i hope you guys

4条回答
  •  粉色の甜心
    2021-01-28 16:45

    You need to set a CSS position property other than static to the element so CSS left property can work.

    .css-box{
         position: absolute;
         width : 100px;
         height : 100px;
         margin : auto;
         background-color : blue;
    }
    

提交回复
热议问题