How to draw graphics in css and move accordingly in any direction as we want? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to draw graphics in css and move accordingly in any direction as we want?

I have to make a box and move in it as I want. Means any pixels right,left,top,bottom by just using arrow keys

6th Mar 2017, 4:28 PM
Avrl Sngh
Avrl Sngh - avatar
1 Answer
+ 11
1> set an key event listener to get the arrows keys when pressed 2> set css property of your box to be 'position:absolute;' mode and dynamically set 'left' and 'top' property let you move it in viewport coordinates...
7th Mar 2017, 5:03 AM
visph
visph - avatar