css background image
background-image: url("image.png"); background-position: center; background-repeat: no-repeat; background-size: cover;
js style background image by id
document.getElementById('Demo').style.backgroundImage = "url('Test.png')";
javascript background image
const bgImage = document.querySelector('.classname') bgImage.style.backgroundImage = "url('your-image.png')" // Javascript createElement const divBackground = document.createElement("div") divBackground.style.background = 'url('your-image.png')' document.body.appendChild(divBackground)