1. Computing

Discuss in my forum

background-clip

By , About.com Guide

Background image clipped to the content box

Background image clipped to the content box

Courtesy J Kyrnin

background-clip Description:

The background-clip property determines the background painting area. You can use this property when layering multiple background images to change where the various images are clipped in the box.

background-clip in CSS Versions:

background-clip Syntax:

background-clip: box;

Box has the values:

  • border-box(default)
    The background is painted within the border box—underneath the border.
  • padding-box
    The background is painted within the padding box. The border is outside the background image.
  • content-box
    The background is painted within the content box. The border and padding are outside the background image.

background-clip Initial Value:

border-box

background-clip Applies To:

All elements.

background-clip Inheritance:

This property is not inherited.

background-clip Browser Support:

background-clip Examples:

See the background-clip examples.

Clip to the padding box:

p {
  background-image: url("images/dog.jpg");
  background-clip: padding-box;
}

Clip to the content box:

p {
  background-image: url("images/dog.jpg");
  background-clip: content-box;
}

background-clip Special Notes:

  • The background-clip will have no affect on the HTML element because the root element of a document has a different painted area.
  • Remember that if the painted area is the default or border-box the background image will be painted behind the border.

Other CSS Background References:

©2013 About.com. All rights reserved.