Position the background image relative to the content box:
The backgroundOrigin property sets or returns what the background-position property is relative to.
Note: If the background-attachment property for the background image is "fixed", this property has no effect.
The background-origin property is supported in IE9+, Firefox, Opera, Chrome, and Safari.
Return the backgroundOrigin property:
Set the backgroundOrigin property:
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. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | padding-box |
---|---|
Return Value: | A String, representing the background-origin property of an element |
CSS Version | CSS3 |
CSS reference: background-origin property