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

CSS में z-index प्रॉपर्टी से एलिमेंट्स को लेयर्स में स्टैक करना

CSS z-index प्रॉपर्टी का उपयोग करके डेवलपर एलिमेंट्स को एक-दूसरे के ऊपर स्टैक कर सकते हैं। z-index का मान पॉजिटिव या नेगेटिव हो सकता है।

नोट: यदि ओवरलैप होने वाले एलिमेंट्स में z-index निर्दिष्ट नहीं है, तो वह एलिमेंट दिखाई देगा जो दस्तावेज़ में अंतिम बार उल्लिखित है।

उदाहरण

आइए z-index प्रॉपर्टी का एक उदाहरण देखें:

<!DOCTYPE html> <html> <head> <style> p {    background: url("https://www.tutorialspoint.com/arangodb/images/arangodb.jpg");    background-origin: content-box;    background-repeat: no-repeat;    background-size: cover;    box-shadow: 0 0 3px black;    padding: 20px;    background-origin: border-box; } </style> </head> <body> <h2>ArangoDB</h2> <p>ArangoDB is hailed as a native multi-model database by its developers. This is unlike other NoSQL databases. In this database, the data can be stored as documents, key/value pairs or graphs. As a native multi-model database, ArangoDB eliminates the need to deploy multiple databases, and thus decreases the number of components and their maintenance. Consequently, it reduces the technology-stack complexity for the application. In addition to consolidating your overall technical needs, this simplification leads to lower total cost of ownership and increasing flexibility.</p> </body> </html>

आउटपुट

CSS में z-index प्रॉपर्टी से एलिमेंट्स को लेयर्स में स्टैक करना

एक और उदाहरण

आइए z-index प्रॉपर्टी का एक और उदाहरण देखें:

<!DOCTYPE html> <html> <head> <style> p {    margin: 0;    position: absolute;    top: 50%;    left: 50%;    transform: translate(-50%, -50%); } div{    margin: auto;    position: absolute;    top:0;    left: 0;    right: 0;    bottom: 0; } div:first-child {    background-color: orange;    width: 270px;    height: 120px;    z-index: -2; } div:last-child {    width: 250px;    height: 100px;    z-index: -1;    background-color: turquoise; } </style> </head> <body> <div></div> <p>Variables are the reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.............</p> <div></div> </body> </html>

आउटपुट

CSS में z-index प्रॉपर्टी से एलिमेंट्स को लेयर्स में स्टैक करना

  1. CSS के क्लियर प्रॉपर्टी से फ्लोट बंद करना CSS के क्लियर प्रॉपर्टी से फ्लोट बंद करना

    हम CSS clear प्रॉपर्टी का उपयोग करके फ्लोटेड एलिमेंट के उस साइड को स्पेसिफाई कर सकते हैं जिसे फ्लोइंग कंटेंट से क्लियर किया जाना है।उदाहरणआइए CSS clear प्रॉपर्टी का एक उदाहरण देखते हैं:<!DOCTYPE html> <html> <head> <title>CSS Clear</title> <style type="text/css&

  1. CSS से Z-Index का उपयोग करके ओवरलैपिंग एलिमेंट्स CSS से Z-Index का उपयोग करके ओवरलैपिंग एलिमेंट्स

    CSS Z-Index प्रॉपर्टी का उपयोग करके डेवलपर एलिमेंट्स को एक-दूसरे के ऊपर स्टैक कर सकते हैं। Z-Index का मान पॉजिटिव या नेगेटिव हो सकता है।नोट - यदि ओवरलैप होने वाले एलिमेंट्स में z-index स्पेसिफाई नहीं है तो वह एलिमेंट दिखेगा जो डॉक्यूमेंट में अंत में मेंशन किया गया है।उदाहरणआइए z-index प्रॉपर्टी का ए

  1. CSS से क्रॉस-ब्राउज़र ओपेसिटी कैसे सेट करें? CSS से क्रॉस-ब्राउज़र ओपेसिटी कैसे सेट करें?

    पुराने ब्राउज़र सपोर्ट के लिए कई ओपेसिटी प्रॉपर्टी एक साथ उपयोग करें: opacity (आधुनिक), filter: alpha(opacity=30) (IE 5-9), -moz-opacity (पुराना फायरफॉक्स), -khtml-opacity (पुराना सफारी)। उदाहरण <!DOCTYPE html> <html> <head> <style> body { font-family: Segoe UI, Tahom