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

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


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

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

उदाहरण

 <!DOCTYPE html> <html> <head> <style> #box { border: thick solid gray; width: 300px; height: 200px } </style> </head> <body> <div id = "box">Demo Text</div> <br> <br> <button type = "button" onclick = "display()">बॉर्डर चौड़ाई बदलें</button> <script> function display() { document.getElementById("box").style.borderWidth = "thin"; } </script> </body> </html> 

  1. - JavaScript से एलिमेंट की अधिकतम चौड़ाई कैसे सेट करें?

    उदाहरण maxWidth प्रॉपर्टी से एलिमेंट की अधिकतम चौड़ाई सीमित करें। <!DOCTYPE html> <html> <body> <p>अधिकतम चौड़ाई सेट करने के लिए नीचे क्लिक करें।</p> <button type=button onclick=display()>अधिकतम चौड़ाई</button> <div id=box> <p>

  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>