CSS background-origin Property
- Previous Page background-image
- Next Page background-position
Definition and Usage
background-origin
Property Specification background-position The attribute specifies the position relative to which the background is positioned.
Note:If the background image's background-attachment The attribute is "fixed
If the property has no effect.
See Also:
CSS Tutorial:CSS Background、CSS Background (Advanced)
HTML DOM Reference Manual:backgroundOrigin Property
Example
Position the background image relative to the content box:
div { background-image:url('smiley.gif'); background-repeat:no-repeat; background-position:left; background-origin:content-box; }
CSS Syntax
background-origin: padding-box|border-box|content-box;
Property Value
Value | Description | Test |
---|---|---|
padding-box | The background image is positioned relative to the padding box. | Test |
border-box | The background image is positioned relative to the border box. | Test |
content-box | The background image is positioned relative to the content box. | Test |
Technical Details
Default Value: | padding-box |
---|---|
Inheritance: | no |
Version: | CSS3 |
JavaScript Syntax: | object.style.backgroundOrigin="content-box" |
Browser Support
The numbers in the table indicate the first browser version that fully supports this property.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | IE / Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 4.0 | 3.0 | 10.5 |
- Previous Page background-image
- Next Page background-position