Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The method to alter the background image in HTML is by using the CSS background-image property:

body {
  background-image: url("image-name.jpg");
}

This will set the image named "image-name.jpg" as the background image of the entire webpage.

Alternatively, you can set the background image for a specific element by targeting its CSS selector:

div {
  background-image: url("image-name.jpg");
}

This will set the image named "image-name.jpg" as the background image of all <div> elements on the page.