CSS background-clip Property
Example
div {
border: 5px dashed black;
padding: 10px;
background: red;
}
#example1 {
background-clip: border-box;
}
#example2 {
background-clip: padding-box;
}
#example3 {
background-clip: content-box;
}
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Meaning
The background-clip CSS property sets whether an element's background extends underneath its border box, padding box, or content box.
Default value: | border-box |
Inherited: | No |
Animatable: | No |
Version: | CSS3 |
JavaScript syntax: |
|
Standard Syntax
background-clip:border-box|padding-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 |
---|---|
border-box | This is default value. Specifies that the background extends to the outside edge of the border. Background is drawn below the border. |
padding-box | 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-clip: border-box;
}