CSS3 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
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 #myDIV {
padding: 15px;
border: 10px dotted #000000;
background-color: yellow;
background-clip:border-box;
}
padding-box The background extends to the inside edge of the border #myDIV {
padding: 15px;
border: 10px dotted #000000;
background-color: yellow;
background-clip:padding-box ;
}
content-box The background extends to the edge of the content box #myDIV {
padding: 15px;
border: 10px dotted #000000;
background-color: yellow;
background-clip:content-box ;
}
initial Sets this property to its default value. Read about initial #myDIV {
padding: 15px;
border: 10px dotted #000000;
background-color: yellow;
background-clip:initial;
}
inherit Inherits this property from its parent element. Read about inherit

Post Author: Zahid Farid