I want to create 3 images in different y positon however doing this code it shows the position changed in devtools but not in the browser

<body>

    <div class="img">

        <!-- <img src="../tree-vector.webp" alt=""> -->

    </div>

    <div id="road" class="mainRoad">
    </div>

<script>
let numTimes = 5;

    let tree = document.querySelector(".img");

for(let i = 0; i < numTimes; i+=2){

    let tr = tree.getBoundingClientRect();

    console.log(tr);

    tree.y = (50* i);

    console.log(tree.y);
}
</script>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.