CSS background-origin Property
Description
The CSS property background-origin controls the positioning area of a background image relative to an element’s box model. Essentially, it determines from which box the background image’s positioning is calculated: the content-box, padding-box, or border-box. This distinction is crucial when working with elements that have significant padding or border values, as it affects how the image aligns within the element. By adjusting the origin, designers can create visually precise layouts and control how background images interact with other visual elements inside the box.
When using background-origin, the positioning of the image may seem subtle but can have a noticeable impact on design. For example, if the property is set to content-box, the background will begin from the innermost box, ignoring padding and borders, making the image tightly aligned with the content. On the other hand, choosing padding-box includes the padding area in the positioning, which often allows for a more balanced visual spacing between the content and the edges of the image. Using border-box positions the background relative to the entire element, including borders, which can be especially useful for full-coverage effects or when a decorative border is present.
Another key consideration is how background-origin interacts with the background-clip property. While background-origin determines the starting point for positioning, background-clip controls the visible area of the background image. This means that designers can independently control where the image begins and how much of it is displayed, giving them granular control over layering effects, gradients, and complex patterns. Mastery of background-origin can elevate design precision, particularly in cases involving multiple background images or when combining images with semi-transparent borders and padding.
Definition
- Initial value
- padding-box
- Applies to
- All elements
- Inherited
- No
- Computed value
- As specified
- Animatable
- No
- JavaScript syntax
- object.style.backgroundOrigin
Interactive Demo
Syntax
background-origin: <box> [ , <box> ]*
Values
- border-boxThe position is relative to the border box.
- padding-boxThe position is relative to the padding box.
- content-boxThe position is relative to the content box. Useful for having background images automatically follow the padding.
Example
Browser Support
The following information will show you the current browser support for the CSS background-origin property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
