Background Image
suggest changeThe background-image property is used to specify a background image to be applied to all matched elements. By default, this image is tiled to cover the entire element, excluding margin.
.myClass {
background-image: url('/path/to/image.jpg');
}
To use multiple images as background-image, define comma separated url()
.myClass {
background-image: url('/path/to/image.jpg'),
url('/path/to/image2.jpg');
}
The images will stack according to their order with the first declared image on top of the others and so on.
| Value | Result |
|---|---|
url('/path/to/image.jpg') |
A background image path, or a data URI. Quotes around the URL are optional when the token is a valid URL. Separate multiple images with commas. |
none |
No background image. |
initial |
The property’s initial value. |
inherit |
The parent’s computed value. |
More CSS for Background Image
The following properties are often used with a background image:
background-size: <horizontal> <vertical>;
background-repeat: no-repeat | repeat | repeat-x | repeat-y;
background-position: <horizontal> <vertical> | center | left top | right bottom;
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents