जावास्क्रिप्ट के साथ बैकग्राउंड का पेंटिंग एरिया सेट करने के लिए, backgroundClip प्रॉपर्टी का उपयोग करें। बैकग्राउंड का पेंटिंग एरिया सेट करने के लिए निम्न कोड चलाकर देखें:
उदाहरण
<!DOCTYPE html> <html> <head> <style> #box { border: 2px dashed green; padding: 35px; width: 600px; height: 400px; background-color: blue; background-clip: border-box; } </style> </head> <body> <button onclick="display()">पेंटिंग एरिया सेट करें</button> <div id="box"> यह डेमो टेक्स्ट है! यह डेमो टेक्स्ट है! यह डेमो टेक्स्ट है! यह डेमो टेक्स्ट है! यह डेमो टेक्स्ट है! </div> <script> function display() { document.getElementById("box").style.backgroundClip = "content-box"; } </script> </body> </html>