Ask coding questions

← Back to all posts
In html,css,js
srsly (30)

How would I do like a
<img src = "blah.jpg" width = "84" height = "48"/>
and then do if w clicked change the y position of the image by 40 for example

Answered by Coder100 (16790) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (16790)

using js
ofc

const img = document.querySelector("img");
img.style.position = "absolute";
img.style.left = `${(parseInt(img.style.left) || 0) + 40}px`;

done