List layers with commas. The first layer is on top. The color may appear only on the last layer. Any longhand you omit is reset to its initial value for that layer. The shorthand also resets background-blend-mode. It applies to every element, including ::first-letter and ::first-line, and it is not inherited.
Standard-track.
Not deprecated and not experimental. Baseline widely available. Prefer longhand when you need to change one piece alone, such as only the size in a media query.
Comma means two layers. The first gradient is painted on top. The second gradient is behind it.
The tint lets the fade show.rgba(15, 23, 42, 0.55) is translucent, so you still see the lower layer.
Color only on the last layer.#0f172a sits with the bottom gradient. Putting a color on an earlier layer is invalid.
Order matters. Reverse the list and an opaque bottom layer can hide what you meant to show on top.
Edge Cases & Pitfalls
If the paint disappears, resets, or sits wrong, one of these is usually why.
reset
Omitted values are cleared
background: #fff; sets the color and resets image, position, size, and the rest to their initials. It also resets background-blend-mode. Set longhand after the shorthand when you need to keep earlier pieces.
slash
Size needs position / size
Write center / cover, not cover alone in the shorthand. Without the slash after a position, size is not accepted there.
color
Color only on the last layer
In a comma list, put the color with the final layer. The first layer is on top; the color is always the bottom paint.
a11y
Screen readers skip background images
Assistive technology is not told about background images. Put meaning in an img with alt. Keep text contrast at least 4.5:1 against the paint.
body
Document background often comes from body
If html is transparent with no image, browsers promote the body background to the canvas. Prefer setting the page background on body. Containment on html or body can stop that promotion.
Compatibility
Browser Support
background is a browser painting property. Node.js, Deno, and Bun do not apply it. Basic color and single-image use is older than multiple layers.
✓ Baseline · Widely available since 2015
background
Basic shorthand: every current browser and Internet Explorer. Multiple layers: Chrome 4+, Firefox 3.6+, Safari 3.1+, Edge 12+, Opera 11.5+, Internet Explorer 9+. background-size in the slash form needs modern engines.
98%Shorthand and layers
Google Chrome1+ basic · 4+ layers
Full support
Mozilla Firefox1+ basic · 3.6+ layers
Full support
Apple Safari1+ basic · 3.1+ layers
Full support
Microsoft Edge12+
Full support
Opera3.5+ basic · 11.5+ layers
Full support
Samsung Internet4+
Full support
Internet Explorer4+ basic · 9+ layers
Partial
backgroundWidely supported
Bottom line: Safe for color, single images, position / size, and multiple layers in current browsers. Internet Explorer 8 and older lack multiple backgrounds. Prefer longhand when you need to change one value without resetting the rest.
Remember
Key Takeaways
Role: one line for color, image, position, size, repeat, and related longhands behind the content.
Slash rule: size comes after position as center / cover. Color belongs only on the last layer.
Reset: omitted longhands, and background-blend-mode, return to their initial values.
Meaning: screen readers ignore background images. Keep a fallback color and strong text contrast.
One line:background paints the box. Use longhand when you must change only one piece without clearing the others.
Frequently Asked Questions
It is a shorthand that sets the background longhands in one declaration: color, image, position, size, repeat, attachment, origin, and clip. Values you omit are reset to their initial values for that layer.
With nothing set, the paint is transparent. The longhands start as background-image: none, background-color: transparent, background-repeat: repeat, background-position: 0% 0%, background-size: auto, background-attachment: scroll, background-origin: padding-box, and background-clip: border-box.
background-size and background-position share value types. Size is only allowed immediately after position, separated by a slash, such as center / cover. Without the slash, the browser cannot tell which value is which.
Only on the last layer in the comma list. The first layer is painted on top, closest to the reader. The color sits behind every image layer.
Yes. The shorthand also resets background-blend-mode to its initial value, even though blend-mode is not written in the shorthand. Set blend-mode after the shorthand if you still need it.
It is Baseline and widely available. Basic use works in every current browser and in Internet Explorer. Multiple layers need Internet Explorer 9+, Firefox 3.6+, or Opera 11.5+. It is a browser painting property. Node.js, Deno, and Bun do not apply it.