CSS Background Image

CSS Background Image

background-image The property specifies the image used as the element's background.

By default, the image will repeat to cover the entire element.

Example

The background image of the page can be set like this:

body {
  background-image: url("paper.gif");
}

Try It Yourself

Example

This example shows the text and background imageWrong Combination.Text is difficult to read:

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

Try It Yourself

Note:When using background images, please use images that do not interfere with the text.

You can also set a background image for a specific element, such as the <p> element:

Example

p {
  background-image: url("paper.gif");
}

Try It Yourself