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

JavaScript में बैकग्राउंड इमेज का आकार कैसे सेट करें?

अवलोकन

backgroundSize प्रॉपर्टी बैकग्राउंड इमेज का आकार सेट करती है (चौड़ाई और ऊंचाई)।

उदाहरण

<!DOCTYPE html> <html>    <head>       <style>          #box {             border: 2px dashed blue;             width: 600px;             height: 400px;             background: url('https://www.tutorialspoint.com/videotutorials/images/coding_ground_home.jpg') no-repeat;          }       </style>    </head>    <body>       <button onclick="display()">Set size of background image</button>       <div id="box">       </div>       <script>          function display() {             document.getElementById("box").style.backgroundSize = "150px 200px";          }       </script>    </body> </html>
  1. - JavaScript से फ़ॉन्ट की बोल्डनेस कैसे सेट करें?

    उदाहरण fontWeight प्रॉपर्टी से फ़ॉन्ट की मोटाई सेट करें। <!DOCTYPE html> <html> <body> <h1>हेडिंग 1</h1> <p id=myID> यह डेमो टेक्स्ट है। </p> <button type=button onclick=display()>फ़ॉन्ट परिवार और वजन सेट करें</button>

  1. - JavaScript से लिस्ट-आइटम मार्कर के रूप में इमेज कैसे सेट करें?

    उदाहरण listStyleImage प्रॉपर्टी से कस्टम इमेज को लिस्ट मार्कर के रूप में उपयोग करें। <!DOCTYPE html> <html> <body> <ol id=myID> <li>एक</li> <li>दो</li> </ol> <button type=button onclick=display()>लिस्ट इमेज अपडेट क

  1. - JavaScript से एलिमेंट के सभी मार्जिन्स एक साथ कैसे सेट करें?

    उदाहरण margin शॉर्टहैंड प्रॉपर्टी से चारों मार्जिन एक साथ सेट करें। <!DOCTYPE html> <html> <body> <button type=button onclick=display()>चारों मार्जिन सेट करें</button> <p id=myID>यह डेमो टेक्स्ट है।</p> <script> function display() {