bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/CSS/CSS Foundations
CSS•CSS Foundations

CSS Background Image

CSS background-image

The background-image property specifies an image to use as the background of an element.

By default, the image is repeated so it covers the entire element.

Example

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

Live preview

Example

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

Live preview

Note

When using a background image, use an image that does not disturb the text.

The background image can also be set for specific elements, like the <p> element:

Example

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

Live preview

The CSS Background Image Property

PropertyDescription
background-imageSets the background image for an element

Previous

CSS Backgrounds

Next

CSS Background Image Repeat