Open In App

HTML DOM Style backgroundClip Property

The DOM style backgroundClip Property is used to set or return the painting area of the background.

Syntax: 



object.style.backgroundClip 
object.style.backgroundClip = "border-box|padding-box|content-box|initial|inherit" 

Property Values: 

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>
    <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>
</body>
   
</html>

Output :

 

Supported Browsers: The browser supported by DOM Style backgroundClip Property are listed below: 


Article Tags :