Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

CSS Dictionary

  1. Home
  2. CSS Dictionary
  3. background-image

background-image

Specifies a background image for an element.

Sample Code

div.test { url("img/test.jpg");}
div.test1 { url('img/test.jpg');}
div.test2 { url(img/test.jpg);}

Available Values

ValueDescription
noneNo background image is applied. This is the default value.
Image pathSets the specified image as the background image.

Browser Preview

<p style="background-image: url(/dics/dictionary-css/img/sample_bg.png);">A background image is specified.</p>

Browser Compatibility

Chrome Chrome
1+
Firefox Firefox
1+
Safari Safari
1+
Edge Edge
12+
Supported in all versions.
IE IE
11
10
9
8
7
6
Opera Opera
3.5+
2 and below ×
iOS Safari iOS Safari
1+
Android Android Browser
4.4+
3 and below ×
Chrome Android Chrome Android
Latest
Same support as desktop.
Firefox Android Firefox Android
Latest
Same support as desktop.

※ Version data is based on MDN.

Notes

Specifies a background image. Use none to remove any background image.

You can write the path in any of the following ways:

url("img/test.jpg");
url('img/test.jpg');
url(img/test.jpg);

However, if the directory or file name contains spaces, you must wrap it in " or '.

Note that on Linux and Unix systems, spaces in directory or file names are not recommended. It is safer to rename any files or directories that contain spaces.
background-image is also covered in detail in this tutorial article.

If you find any errors or copyright issues, please .