CSS Background (Cont.)


Background—Shorthand Property (Cont.)
When using the shorthand property the order of the property values are It does not matter if one of the property values are missing, as long as the ones that are present are in this order.

All CSS Background Properties
The number in the “CSS” column indicates in which CSS version the property is defined (CSS1 or CSS2).

Property Description Values CSS
background A shorthand property for setting all background properties in one declaration background-color
background-image
background-repeat background-attachment background-position
1
background-attachment Sets whether a background image is fixed or scrolls with the rest of the page. scroll
fixed
1
background-color Sets the background color of an element. color-rgb
color-hex
color-name
transparent
1
background-image Sets an image as the background. url(URL)
none
1
background-position Sets the starting position of a background image. top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
x% y%
xpos ypos
1
background-repeat Sets if/how a background image will be repeated. repeat
repeat-x
repeat-y
no-repeat
1

Demonstration
The following demonstration shows how the script of HTML and CSS is displayed on the Web: