CSS background-clip Property
Example
Specify how far the background should extend within an element:
div
{
border: 10px dotted black;
padding: 15px;
background:
lightblue;
background-clip:
padding-box;
}
Try it Yourself »
Definition and Usage
The background-clip
property defines how far the background (color or image)
should extend within an element.
Default value: | border-box |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS3 |
JavaScript syntax: | object.style.backgroundClip="content-box" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
background-clip | 4.0 | 9.0 | 4.0 | 3.0 | 10.5 |
CSS Syntax
background-clip: border-box|padding-box|content-box|initial|inherit;
Property Values
Value | Description | Play it |
---|---|---|
border-box | Default value. The background extends behind the border | Play it » |
padding-box | The background extends to the inside edge of the border | Play it » |
content-box | The background extends to the edge of the content box | Play it » |
initial | Sets this property to its default value. Read about initial | Play it » |
inherit | Inherits this property from its parent element. Read about inherit |
Related Pages
CSS tutorial: CSS Backgrounds
HTML DOM reference: backgroundClip property