background image in javascript code example
Example 1: css background image
background-image: url("image.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
Example 2: js background image
document.body.style.backgroundImage = "url('img_tree.png')";
Example 3: background image html
<head>
<style>
.background {
background-image: url(https://cleananddelicious.com/wp-content/uploads/2016/03/Avocad0-CD.jpg);
}
</style>
</head>
<body>
<div class=background>
<h1>The background of this div will be an avocado</h1>
</div>
</body>