পজিশনিং এলিমেন্টের জন্য, CSS-এর নিম্নলিখিত পজিশনিং পদ্ধতি রয়েছে -
CSS-এ আপেক্ষিক অবস্থান
আপেক্ষিক অবস্থানের সাথে, উপাদানটি তার স্বাভাবিক অবস্থানের সাথে সম্পর্কিত হয়। এর জন্য, অবস্থান ব্যবহার করুন:আপেক্ষিক।
উদাহরণ
<!DOCTYPE html>
<html>
<head>
<style>
div.demo {
position: relative;
color: white;
background-color: orange;
border: 2px dashed blue;
left: 50px;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<p>This is demo text.</p>
<p>This is demo text.</p>
<div class="demo">
position: relative;
</div>
<p>This is another demo text.</p>
</body>
</html> আউটপুট

CSS এ পরম অবস্থান
পরম অবস্থানের সাথে, একটি উপাদান নিকটতম অবস্থানের পূর্বপুরুষের সাপেক্ষে অবস্থান করা হয়।
উদাহরণ
<!DOCTYPE html>
<html>
<head>
<style>
div.demo1 {
position: relative;
color: white;
background-color: orange;
border: 2px dashed blue;
width: 600px;
height: 200px;
}
div.demo2 {
position: absolute;
color: white;
background-color: orange;
border: 2px dashed blue;
top: 50px;
right: 0;
width: 300px;
height: 100px;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<p>This is demo text.</p>
<p>This is demo text.</p>
<p>This is demo text.</p>
<p>This is demo text.</p>
<div class="demo1">position: relative;
<div class="demo2">
position: absolute;
</div>
</div>
<p>This is another demo text.</p>
<p>This is demo text.</p>
<p>This is demo text.</p>
</body>
</html> আউটপুট

CSS-এ স্থির অবস্থান
অবস্থান সহ একটি উপাদান সেট:স্থির; পৃষ্ঠাটি স্ক্রোল করার পরেও একই জায়গায় থাকে।
উদাহরণ
<!DOCTYPE html>
<html>
<head>
<style>
div.demo1 {
position: relative;
color: white;
background-color: orange;
border: 2px dashed blue;
width: 600px;
height: 200px;
}
div.demo2 {
position: absolute;
color: white;
background-color: orange;
border: 2px dashed blue;
top: 50px;
right: 0;
width: 300px;
height: 100px;
}
div.demo3 {
position: fixed;
bottom: 0;
right: 20px;
width: 500px;
border: 3px solid orange;
color: blue;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<p>This is demo text.</p>
<p>This is demo text.</p>
<p>This is demo text.</p>
<p>This is demo text.</p>
<div class="demo1">position: relative;
<div class="demo2">
position: absolute;
</div>
<div class="demo3">
position: fixed;
</div>
</div>
<p>This is another demo text.</p>
</body>
</html> আউটপুট
