स्टाइल बैकग्राउंड रिपीट प्रॉपर्टी का उपयोग बैकग्राउंड इमेज को खुद को दोहराने के तरीके को सेट करने या प्राप्त करने के लिए किया जाता है।
सिंटैक्स
−
. के लिए वाक्य रचना निम्नलिखित हैबैकग्राउंड रिपीट प्रॉपर्टी सेट करना -
object.style.backgroundRepeat = "repeat|repeat-x|repeat-y|no-repeat|initial|inherit"
मान
उपरोक्त संपत्ति मूल्य निम्नलिखित हैं -
| Sr.No | <वें शैली ="चौड़ाई:89.9679%; पाठ-संरेखण:केंद्र;">मान और विवरण|
|---|---|
| 1 | दोहराएं यह व्यतिक्रम मूल्य है। यह पृष्ठभूमि छवि को लंबवत और क्षैतिज रूप से दोहराता है। |
| 2 | repeat-x यह पृष्ठभूमि छवि को केवल क्षैतिज रूप से दोहराता है। |
| 3 | दोहराना-y यह केवल पृष्ठभूमि छवि को लंबवत रूप से दोहराता है |
| 4 | नो-रिपीट पृष्ठभूमि छवि को दोहराता नहीं है। |
उदाहरण
आइए बैकग्राउंड रिपीट प्रॉपर्टी के लिए एक उदाहरण देखें -
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url("https://www.tutorialspoint.com/power_bi/images/power-bi-minilogo.jpg");
background-repeat: repeat-x;
color:black;
font-size:20px;
}
</style>
<script>
function changeBackRepeat(){
document.body.style.backgroundRepeat="repeat-y";
document.getElementById("Sample").innerHTML="The background image is now repeated vertically";
}
</script>
</head>
<body>
<h2>Demo Heading</h2>
<p>This is demo text.</p>
<p>This is demo text.</p>
<p>This is demo text.</p>
<p>This is demo text.</p>
<p>Change the body background image repeat value by clicking the below button</p>
<button onclick="changeBackRepeat()">CHANGE REPEAT</button>
<p id="Sample"></p>
</body>
</html> आउटपुट
यह निम्नलिखित आउटपुट देगा -

चेंज रिपीट बटन पर क्लिक करने पर -
