CSS3 background-clip property
Example
Specify the background painting area:
div
{
background-color:
yellow
;
background-clip:
content-box
;
}
Try it »
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| background-clip | 4.0 | 9.0 | 4.0 | 3.0 | 10.5 |
Tag Definition and Usage Notes
The background-clip property specifies the background painting area.
| Default value: | border-box |
|---|---|
| Inherited: | no |
| Version: | CSS3 |
| JavaScript syntax: | object object.style.backgroundClip="content-box" |
Syntax
background-clip: border-box | padding-box | content-box;
| Value | Description |
|---|---|
| border-box | Default value. The background starts filling from the outer edge of the element (including the border). This is the default value of background-clip, meaning the background image or color extends to the entire element area including the border area. |
| padding-box | The background fills only up to the padding area, meaning it does not extend into the border area. The background image or color is clipped inside the border, but excludes the border. |
| content-box | The background fills only up to the content area, meaning it appears only within the content area, excluding the padding and border areas entirely. The background is clipped within the content area. |
Related Articles
CSS3 tutorial: CSS3 Backgrounds