स्टाइल zIndex प्रॉपर्टी
उदाहरण
<img> तत्व का स्टैक क्रम बदलें:
document.getElementById("img1").style.zIndex = "1";
परिभाषा और उपयोग
zIndex प्रॉपर्टी किसी पोजिशन किए गए एलिमेंट के स्टैक ऑर्डर को सेट या लौटाती है।
अधिक स्टैक ऑर्डर वाला एक तत्व (1) हमेशा निचले स्टैक ऑर्डर (0) वाले दूसरे तत्व के सामने होता है।
युक्ति: एक स्थित तत्व एक तत्व है जिसमें स्थिति गुण सेट होता है: सापेक्ष, पूर्ण, या निश्चित।
युक्ति: यदि आप अतिव्यापी तत्व बनाना चाहते हैं तो यह गुण उपयोगी है।
ब्राउज़र समर्थन
Property | |||||
---|---|---|---|---|---|
zIndex | Yes | Yes | Yes | Yes | Yes |
वाक्य - विन्यास
zIndex प्रॉपर्टी लौटाएं:
object.style.zIndex
zIndex गुण सेट करें:
object.style.zIndex = "auto|number|initial|inherit"
सम्पत्ति की कीमत
Value | Description |
---|---|
auto | The browser determines the stack order of the element (based on its order in the document). This is default |
number | An integer that defines the stack order of the element. Negative values are allowed |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
टेक्निकल डिटेल
डिफ़ॉल्ट मान: | ऑटो |
---|---|
प्रतिलाभ की मात्रा: | एक स्ट्रिंग, एक तत्व के ढेर क्रम का प्रतिनिधित्व करता है |
सीएसएस संस्करण | सीएसएस 2 |
और ज्यादा उदाहरण
उदाहरण
<div> तत्व का z-index गुण मान बदलें:
document.getElementById("myDIV").style.zIndex = "-1";
उदाहरण
एक <img> तत्व का z-index गुण मान लौटाएँ:
alert(document.getElementById("img1").style.zIndex);
संबंधित पृष्ठ
सीएसएस ट्यूटोरियल: सीएसएस पोजिशनिंग
सीएसएस संदर्भ: जेड-इंडेक्स संपत्ति
❮ स्टाइल ऑब्जेक्ट