CSS background-origin Property
Example
div {
border: 5px dashed black;
padding: 10px;
background: url(bg-paper.jpg);
background-repeat: no-repeat;
}
#example1 {
background-origin: padding-box;
}
#example2 {
background-origin: border-box;
}
#example3 {
background-origin: content-box;
}
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Meaning
The background-origin CSS property sets the background's origin: from the border start, inside the border, or inside the padding.
Default value: | padding-box |
Inherited: | No |
Animatable: | No |
Version: | CSS3 |
JavaScript syntax: |
|
Standard Syntax
background-origin: padding-box|border-box|content-box|initial|inherit|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
padding-box | Specifies that the background extends to the outside edge of the border. Background is drawn below the border. |
border-box | This is default value. Specifies that the background extends to the outside edge of the padding. No background is drawn below the border. |
content-box | Specifies that the background is painted within (clipped to) the content box only. No background is drawn below the border and padding area. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
background-origin: padding-box;
}