पोजिशनिंग तत्वों के लिए, 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> आउटपुट

सीएसएस में पूर्ण स्थिति निर्धारण
पूर्ण स्थिति के साथ, एक तत्व निकटतम स्थित पूर्वज के सापेक्ष स्थित होता है।
उदाहरण
<!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> आउटपुट

सीएसएस में फिक्स्ड पोजिशनिंग
स्थिति के साथ एक तत्व सेट:निश्चित; पृष्ठ स्क्रॉल करने पर भी उसी स्थान पर बना रहता है।
उदाहरण
<!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> आउटपुट
