All-in-one background spec

background

This property sets all of these properties in a single declaration: background-attachment, background-clip, background-color, background-image, background-origin, background-position, background-repeat, background-size.

Property values

Some or all of the individual background property values may be specified, in any order.

Note that the keywords for background-origin and background-clip are identical. If only one of these keywords is provided, it sets both properties. If both of these keywords are provided, the first one sets the background-origin and the second one sets the background-clip.

Examples

/* a simple background color */
background: black;

/* an image, resized to fit the element's size */
background: url(bg.png) contain;

/* a centered image with unused area in black */
background: url(bg.png) center black;
background
0

style > background > backgroundAll-in-one background spec

🔗 🔎