Style backgroundOrigin property
Example
Position the background image relative to the content box:
document.getElementById("myDIV").style.backgroundOrigin="content-box";
Try it »
Definition and Usage
The backgroundOrigin property sets or returns what the background-position property is positioned relative to.
**Note:** If the background-attachment property of the background image is "fixed", this property has no effect.
Browser support

IE9+, Firefox, Opera, Chrome, and Safari support the background-origin property.
Syntax
Return the backgroundOrigin property:
object
.style.backgroundOrigin
Set the backgroundOrigin property:
object
.style.backgroundOrigin="padding-box|border-box|content-box|initial|inherit"
Attribute values
| Value | Description |
|---|---|
| padding-box | Default value. The background image is positioned relative to the padding box. |
| border-box | The background image is positioned relative to the border box. |
| content-box | The background image is positioned relative to the content box. |
| initial | Sets this property to its default value. See initial. |
| inherit | Inherits this property from its parent element. See inherit. |
Technical Details
| Default value: | padding-box |
|---|---|
| Return Value: | A string representing the element's background-origin property. |
| CSS version | CSS3 |
Related Articles
CSS Reference Manual:The background-origin property
The Style object