how to have an image as a background html code example
Example 1: how to set background image in html
<div style="background-image: url('img.jpg');">
<style>
div {
background-image: url('img.jpg');
}
</style>
<style>
body {
background-image: url('img.jpg');
}
</style>
Example 2: 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>