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

जावास्क्रिप्ट में किसी एलिमेंट की चौड़ाई कैसे सेट करें?


किसी एलिमेंट की चौड़ाई सेट करने के लिए जावास्क्रिप्ट में width प्रॉपर्टी का उपयोग करें।

उदाहरण

जावास्क्रिप्ट में किसी एलिमेंट की चौड़ाई सेट करना सीखने के लिए निम्न कोड चलाकर देखें:

<!DOCTYPE html> <html>    <body>       <button type="button" id="btn" onclick="display()">       ऊंचाई और चौड़ाई बदलें       </button>       <script>          function display() {             document.getElementById("btn").style.width = "250px";             document.getElementById("btn").style.height = "250px";          }       </script>    </body> </html>

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

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

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

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

  1. - JavaScript से एलिमेंट के चारों ओर आउटलाइन की चौड़ाई कैसे सेट करें?

    उदाहरण outlineWidth प्रॉपर्टी से आउटलाइन की मोटाई सेट करें। <!DOCTYPE html> <html> <head> <style> #box { width: 450px; background-color: orange; border: 3px solid red; margin-left: 20px; } </style> </head>