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

जावास्क्रिप्ट में पोजिशन्ड एलिमेंट का स्टैक ऑर्डर कैसे सेट करें?


स्टैक ऑर्डर सेट करने के लिए, zIndex प्रॉपर्टी का उपयोग करें। जावास्क्रिप्ट में zIndex प्रॉपर्टी लागू करना सीखने के लिए निम्न कोड चलाकर देखें:

उदाहरण

<!DOCTYPE html> <html>    <head>       <style>          #myID {             position: absolute;             left: 20px;             top: 20px;             z-index: -1          }       </style>    </head>    <body>       <img id = "myID"          src="https://www.tutorialspoint.com/videotutorials/images/tutor_connect_home.jpg"          width = "150" height = "150">       <button type="button" onclick="myFunction()">स्टैक ऑर्डर सेट करें</button>       <p>Z-index is -1</p>       <script>          function myFunction() {             document.getElementById("myID").style.zIndex = "1";          }       </script>    </body> </html>

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

    उदाहरण marginTop प्रॉपर्टी से एलिमेंट का शीर्ष मार्जिन सेट करें। <!DOCTYPE html> <html> <head> <style> #myID { border: 2px solid #000000; } </style> </head> <body> <div id=myID>यह डेमो टेक्स्ट है।</div><br

  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() {