CSS background is used to define different background properties in single setting. background can be used for the CSS background-image, can be used for background-position and all other properties.

The syntax for background is:

For Example:

Output

This is the HTML paragraph inside the div. The div contains some background image. This background image has fixed attachment. The background showing the nature image.

CSS background values list

The values and description of this property is used to specify the background property in single setting.

Sr. No. value Description
1 url(image url location) Used to make background image. The value for this is the location of the image. See background-image property for this
2 none Used to make no background image.
3 repeat style Used to make background image repeat or not repeat. The value for this is repeat or no-repeat. See background-repeat property for this
4 size Used to set background image size. See background-size property for this
5 attachment Used to make background image attachment. To know more detail, See background-attachment property for this.
6 color Used to give background color. See background-color property for this
7 initial Used to define as the property initial value.
8 inherit Used to define the computed value of property on the elements parent.
9 unset Used to set all the properties to their parent value if inheritable.

CSS background with position center

In this example we will use background-image with center position.

Output

This is the HTML paragraph inside the div. The div contains some background image. This background image has fixed attachment. The background showing the nature image.