CSS backgroundclip Property (original) (raw)

CSS background-clip Property

Last Updated : 23 Aug, 2024

The background-clip property in CSS controls how a background (color or image) extends within an element, allowing you to dictate the reach of your background.

**Syntax:

background-clip: border-box | padding-box | content-box | text | initial | inherit;

**Property value:

Examples of CSS background-clip Property

**Example: In this example, we are using the background-clip: border-box property.

html `

Border Box

GeeksforGeeks

background-clip: border-box;

`

**Output:

**Example: In this example, we are using the background-clip: padding-box property.

html `

padding-box property
<div class="gfg">
    <h2>
        GeeksforGeeks
    </h2>
    <p>
        background-clip: padding-box;
    </p>
</div>

`

**Output:

**Example: In this example, we are using the background-clip: content-box property.

html `

content-box property
<div class="gfg">
    <h2>
        GeeksforGeeks
    </h2>
    <p>
        background-clip: content-box;
    </p>
</div>

`

**Output:

**Example: In this example, we are using the background-clip: initial-box property.

html `

Initial
<div class="gfg">
    <h2>
        GeeksforGeeks
    </h2>
    <p>
        background-clip: initial;
    </p>
</div>

`

**Output:

**Supported Browsers: