HTML | DOM Style backgroundClip Property
The DOM style backgroundClip Property is used to set or returns the painting area of the background.
Syntax:
object.style.backgroundClip
object.style.backgroundClip = "border-box|padding-box|content-box| initial|inherit"
Property Values:
- border-box property: The border-box property is used to set the background color spread over the whole division.
- padding-box property: The padding-box property is used to set the background inside the border.
- content-box property: The content-box property is used to set the background color upto the content only.
Example:
<!DOCTYPE html> <html> <head> <title>Border Box</title> <style> #gfg { background-color: green; background-clip: border-box; text-align: center; border: 10px dashed black; color: white; } </style> </head> <body> <center> <h1> DOM Style backgroundClip Property </h1> <div id="gfg"> <h2> GeeksforGeeks </h2> <p> background-clip: border-box; </p> </div> <br> <button onclick="myGeeks()">Submit</button> <script> function myGeeks() { document.getElementById("gfg" ).style.backgroundClip = "padding-box"; } </script> </center> </body> </html> |
chevron_right
filter_none
Output :
Before Clicking On Button:

After Clicking On Button:

Supported Browsers: The browser supported by DOM backgroundClip Property are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- HTML | DOM Style top Property
- HTML | DOM Style right Property
- HTML | DOM Style transform Property
- HTML | DOM Style animationName Property
- HTML | DOM Style columnRuleStyle Property
- HTML | DOM Style outline Property
- HTML | DOM Style textAlignLast Property
- HTML | DOM Style order Property
- HTML | DOM Style backgroundImage Property
- HTML | DOM Style verticalAlign Property
- HTML | DOM Style flexGrow Property
- HTML | DOM Style listStyleImage Property
- HTML | DOM Style flexWrap Property
- HTML | DOM Style animationDelay Property
- HTML | DOM Style backfaceVisibility Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Code_Mech


