backgroundClip प्रॉपर्टी हमें यह नियंत्रित करने देती है कि पृष्ठभूमि छवि कितनी दूर तक चित्रित होगी यानी पृष्ठभूमि छवि का पेंटिंग क्षेत्र। इसका उपयोग उस पेंटिंग क्षेत्र को सेट या प्राप्त करने के लिए किया जाता है।
सिंटैक्स
backgroundClip प्रॉपर्टी सेट करने के लिए सिंटैक्स निम्नलिखित है:
background-clip: border-box | padding-box | content-box
मान
निम्नलिखित मान हैं:
| क्रमांक | मान एवं विवरण |
|---|---|
| 1 | border-box यह पृष्ठभूमि को बॉर्डर-बॉक्स के भीतर क्लिप करता है और यह डिफ़ॉल्ट मान है। |
| 2 | padding-box यह पृष्ठभूमि को पैडिंग बॉक्स के भीतर क्लिप करता है। |
| 3 | content-box पृष्ठभूमि कंटेंट बॉक्स के भीतर क्लिप की जाती है। |
उदाहरण
backgroundclip प्रॉपर्टी का एक उदाहरण देखते हैं:
<!DOCTYPE html> <html> <head> <style> #one { box-shadow: 0 0 2px black; padding: 18px; background: skyblue; background-clip: content-box; } </style> <script> function changeBackClip(){ document.getElementById("one").style.backgroundClip="padding-box"; document.getElementById("Sample").innerHTML="The background clip property is now padding-box"; background-clip: border-box | padding-box | content-box } </script> </head> <body> <div id="one"> Phasellus eu justo lectus. Praesent et nulla facilisis, venenatis justo eget, tempor lectus. Integer ut felis vel lectus convallis fermentum. Fusce ut felis mauris.</div> <p>Change the above div background-clip value by clicking the below button</p> <button onclick="changeBackClip()">CHANGE CLIP</button> <p id="Sample"></p> </body> </html>
आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा:

CHANGE CLIP बटन पर क्लिक करने पर:
