background-clip property CSS Reference



Definition and Usage

The background-clip CSS property specifies whether an element's background, either the color or image, extends underneath its border.

If there is no background image, this property has only visual effect when the border has transparent regions (because of border-style) or partially opaque regions; otherwise the border covers up the difference.

  • Initial border-box
  • Applies to all elements
  • Inherited no
  • Media visual
  • Computed Value as specified
  • Animatable no
  • Canonical order the unique non-ambiguous order defined by the formal grammar

Syntax

Formal syntax: <box>#
background-clip: border-box
background-clip: padding-box
background-clip: content-box
background-clip: inherit

Values

border-box
The background extends to the outside edge of the border (but underneath the border in z-ordering).
padding-box
No background is drawn below the border (background extends to the outside edge of the padding).
content-box
The background is painted within (clipped to) the content box.

Examples

pre {
   border: 5px navy;
   border-style: dotted double;
   background: #F8D575;
   /* The yellow background will not go behind the border */
   background-clip: padding-box;
}

Compatibility

Desktop browsers

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support1.04.0 (2.0)9.010.53.0 (522)
content-box1.04.0 (2.0)9.012.0 (maybe earlier)3.0 (522)

Mobile browsers

FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic supportNANANANANA
content-boxNANANANANA

Relative articles