CSS background-clip

This CSS property specifies the painting area of the background. It limits the area in which the background color or image appears by applying a clipping box. Anything outside the box will be discarded and invisible.

It sets whether the background of an element extends under the border-box, padding-box, and content-box.

Syntax

Possible values

Let's understand the property values along with an example of each.

border-box

It is the default value. It means that the background image and color will be drawn inside the border-box. It sets the background color, which spreads over the entire division.

Example

Test it Now

padding-box

It sets the background within the border, i.e., the background image and color are drawn inside the padding-box.

Example

Test it Now

content-box

It sets the background-color up to the content only. The background is painted inside the content box, i.e., the background image and color will be drawn in the content box.

Example

Test it Now





Latest Courses