Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> HTML

HTML DOM Style backgroundClip प्रॉपर्टी


backgroundClip प्रॉपर्टी हमें यह नियंत्रित करने देती है कि पृष्ठभूमि छवि कितनी दूर तक चित्रित होगी यानी पृष्ठभूमि छवि का पेंटिंग क्षेत्र। इसका उपयोग उस पेंटिंग क्षेत्र को सेट या प्राप्त करने के लिए किया जाता है।

सिंटैक्स

backgroundClip प्रॉपर्टी सेट करने के लिए सिंटैक्स निम्नलिखित है:

background-clip: border-box | padding-box | content-box

मान

निम्नलिखित मान हैं:

क्रमांकमान एवं विवरण
1border-box
यह पृष्ठभूमि को बॉर्डर-बॉक्स के भीतर क्लिप करता है और यह डिफ़ॉल्ट मान है।
2padding-box
यह पृष्ठभूमि को पैडिंग बॉक्स के भीतर क्लिप करता है।
3content-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>

आउटपुट

यह निम्नलिखित आउटपुट उत्पन्न करेगा:

HTML DOM Style backgroundClip प्रॉपर्टी

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

HTML DOM Style backgroundClip प्रॉपर्टी


  1. HTML DOM Style backgroundRepeat प्रॉपर्टी HTML DOM Style backgroundRepeat प्रॉपर्टी

    style backgroundRepeat प्रॉपर्टी का उपयोग यह सेट या प्राप्त करने के लिए किया जाता है कि पृष्ठभूमि छवि खुद को कैसे दोहराती है। सिंटैक्स backgroundRepeat प्रॉपर्टी सेट करने के लिए सिंटैक्स निम्नलिखित है: object.style.backgroundRepeat = repeat|repeat-x|repeat-y|no-repeat|initial|inherit मान उपरोक्त प्

  1. HTML DOM Style backgroundColor प्रॉपर्टी HTML DOM Style backgroundColor प्रॉपर्टी

    backgroundColor प्रॉपर्टी का उपयोग किसी तत्व के लिए पृष्ठभूमि रंग सेट या प्राप्त करने के लिए किया जाता है। हम मानक नामों, rgb(), rgba(), hsl() या hsla() द्वारा मान निर्दिष्ट कर सकते हैं। सिंटैक्स backgroundColor प्रॉपर्टी सेट करने के लिए सिंटैक्स निम्नलिखित है: object.style.backgroundColor = color|

  1. HTML DOM Style background प्रॉपर्टी HTML DOM Style background प्रॉपर्टी

    background प्रॉपर्टी का उपयोग किसी तत्व से जुड़ी पृष्ठभूमि छवि को सेट या प्राप्त करने के लिए किया जाता है। यह एक शॉर्टहैंड प्रॉपर्टी है और 8 गुणों तक में हेरफेर कर सकती है। सिंटैक्स background प्रॉपर्टी सेट करने के लिए सिंटैक्स निम्नलिखित है: object.style.background = color image repeat attachment