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

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


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

सिंटैक्स

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

object.style.backgroundAttachment = "scroll|fixed|local|initial|inherit"

मान

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

क्रमांकमान एवं विवरण
1Scroll
यह डिफ़ॉल्ट मान है और यह पृष्ठभूमि को छवि के साथ स्क्रॉल करता है।
2Fixed
यह व्यूपोर्ट के संबंध में पृष्ठभूमि को स्थिर करता है।
3Local
पृष्ठभूमि को तत्व की सामग्री के साथ स्क्रॉल करने के लिए।
4Initial
इस प्रॉपर्टी को उसके प्रारंभिक मान पर सेट करने के लिए।
5inherit
पैरेंट प्रॉपर्टी मान को विरासत में लेने के लिए।

उदाहरण

backgroundAttachment प्रॉपर्टी का उदाहरण देखते हैं:

<!DOCTYPE html> <html> <head> <style>    body {       background-image: url("https://www.tutorialspoint.com/artificial_intelligence_with_python/images/artificialintelligence-with-python-mini-logo.jpg");       background-repeat: no-repeat;       background-attachment: fixed;       background-position: top;    }    article {       color: white;       background: rgba(0, 0, 0, 0.4);    } </style> <script>    function changeAttachment(){       document.getElementById("BODY1").style.backgroundAttachment="local";       document.getElementById("Sample").innerHTML="The background will now scroll along with the page.";    } </script> </head> <body id="BODY1"> <h2>This is demo heading</h2> <p>Curabitur tincidunt elit libero, sed ullamcorper urna ullamcorper ut. Nulla scelerisque, quam in efficitur porta, nisi turpis blandit odio, vitae ultricies lectus ex vel felis. Proin lectus nulla, cursus vitae massa ac, mollis gravida orci. Cras euismod imperdiet elit, aliquet placerat purus bibendum vel. Nullam vehicula urna non ullamcorper congue. Etiam volutpat gravida tempus. Fusce non volutpat diam. Nullam sagittis condimentum dui, a pharetra mi commodo nec. Cras vulputate hendrerit ornare. Sed id ligula sit amet arcu dapibus molestie nec at risus. Aliquam gravida, dolor non vehicula lobortis, augue erat gravida metus, id eleifend ante risus vel turpis. Nunc fermentum scelerisque nulla, non gravida dui consequat malesuada. Pellentesque mollis scelerisque quam ac efficitur. Nunc ante velit, efficitur vitae dignissim semper, maximus in mi.</p> <ul> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> </ul> <p> Vivamus eget nisi eu libero viverra vestibulum. Nulla luctus ultrices metus, nec dapibus magna dignissim eget. Ut sed posuere erat.</p> <p>Nunc ante velit, efficitur vitae dignissim semper, maximus in mi.</p> <p>Pellentesque vitae est eget est tempus pretium. Phasellus semper erat efficitur justo tristique sollicitudin. Morbi mi eros, aliquet ac gravida ac, tempor et ante. </p> <p>Aenean non justo non lorem accumsan fermentum efficitur at quam. Morbi rhoncus lacus sed est luctus, a hendrerit est ullamcorper. Etiam quis nisl non sem fringilla ullamcorper. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec ac malesuada turpis. Donec dapibus diam metus, nec blandit tellus vulputate quis.</p> <p>Donec blandit tincidunt ante, sed blandit massa volutpat eu. Mauris ac porta lectus, et vulputate ante.</p> <p>Click the below button to change the above div backface visibility value</p> <button onclick="changeAttachment()">CHANGE ATTACHMENT</button> <p id="Sample"></p> </body> </html>

आउटपुट

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

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

CHANGE ATTACHMENT बटन पर क्लिक करने पर छवि शीर्ष पर स्थिर हो जाएगी और नीचे दिखाई नहीं देगी:

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


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

    विवरण HTML DOM Style transformStyle प्रॉपर्टी HTML दस्तावेज़ में किसी तत्व पर 2D या 3D ट्रांसफॉर्मेशन को प्राप्त और लागू करती है। सिंटैक्स transformStyle प्राप्त करना object.style.transformStyle transformStyle संशोधित करना object.style.transformStyle = value मान यहां value निम्नलिखित हो सकते हैं

  1. HTML DOM Style transformOrigin गुणधर्म HTML DOM Style transformOrigin गुणधर्म

    HTML DOM style transformOrigin गुणधर्म किसी HTML दस्तावेज़ में एक तत्व पर 2D या 3D ट्रांसफ़ॉर्मेशन लागू करने का स्थान निर्धारित करता है और उसे लौटाता है। वाक्य रचना (Syntax) निम्नलिखित वाक्य रचना है: transformOrigin लौटाना object.style.transformOrigin transformOrigin संशोधित करना object.style.tr

  1. HTML DOM Style quotes गुणधर्म HTML DOM Style quotes गुणधर्म

    HTML DOM style quotes गुणधर्म HTML दस्तावेज़ में उद्धरण चिह्नों के प्रकार को लौटाता है और संशोधित करता है। वाक्य रचना (Syntax) निम्नलिखित वाक्य रचना है: quotes लौटाना object.style.quotes quotes संशोधित करना object.style.quotes = value मान (Values) यहाँ मान निम्न हो सकते हैं: मान व्याख्या