let btn = document.getElementById('moveBtn');
let img = document.getElementById('backgroundImg');
btn.addEventListener('click', () => {
img.style.left = "100px"
})
#backgroundImg {
position: relative;
height: 100px;
width: 100px;
background-color: red;
}
.moveImage {
display: flex;
flex-direction: column;
width: 200px;
}
<div class="moveImage ">
<img src="" alt="" id="backgroundImg">
<button id="moveBtn">Click</button>
</div>
Here's the code , i've used backgroundcolor but you can use background image