কম্পিউটার

CSS ব্যবহার করে z-index প্রপার্টি ব্যবহার করে লেয়ারে এলিমেন্ট স্ট্যাক করা


CSS Z-Index প্রপার্টি ডেভেলপার ব্যবহার করে একে অপরের সাথে উপাদান স্ট্যাক করতে পারে। Z-সূচকের একটি ইতিবাচক বা একটি নেতিবাচক মান থাকতে পারে৷

নোট - যদি ওভারল্যাপ হওয়া উপাদানগুলিতে z-সূচক নির্দিষ্ট না থাকে তবে সেই উপাদানটি প্রদর্শিত হবে যা নথিতে সর্বশেষ উল্লেখ করা হয়েছে।

আসুন 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 ব্যবহার করে উপাদানগুলির চারপাশে মার্জিন স্পেস সেট করা

  2. CSS এর ক্লিয়ার প্রপার্টি ব্যবহার করে ফ্লোট বন্ধ করা

  3. CSS ব্যবহার করে Z-Index-এর সাথে ওভারল্যাপিং উপাদান

  4. CSS ব্যবহার করে ক্রস ব্রাউজার অপাসিটি সেট করা