Colors

background-image

Learn how to use the CSS background-image property.

CSS background-image

The background-image property sets the background image for an HTML element.

Syntax

.element {
  background-image: url("img.png");
}

HTML Context Example

<div class="card">
  This is a styled element.
</div>

<style>
.card {
  background-image: url("img.png");
}
</style>

Notes

Experiment in the CSS playground to see how this affects layout and styling.