आप absolute
और relative
स्थिति का उपयोग कर सकते लेकर असमंजस में हैं।
उदाहरण
के लिए
एचटीएमएल
<div id="container" class="box">
<div class="box top left"></div>
<div class="box top center"></div>
<div class="box top right"></div>
<div class="box middle left"></div>
<div class="box middle center"></div>
<div class="box middle right"></div>
<div class="box bottom left"></div>
<div class="box bottom center"></div>
<div class="box bottom right"></div>
</div>
सीएसएस
#container{
width:200px;
height:200px;
position:relative;
border:1px solid black;
}
.box{
border:1px solid red;
position:absolute;
width:20px;
height:20px;
}
.top{top:0}
.middle{top:50%;margin-top:-10px;/*half of the .box height*/}
.bottom{bottom:0}
.left{left:0;}
.center{left:50%;margin-left:-10px;/*half of the .box width*/}
.right{right:0;}
डेमोhttp://jsfiddle.net/gaby/MB4Fd/1/
पर 10
(बिल्कुल आप वास्तविक स्थिति आप पसंद के, ऊपर/छोड़ दिया/सही/नीचे बदलकर समायोजित कर सकते हैं महत्व देता)
स्रोत
2013-02-25 14:06:19
तुम्हारा मतलब है: आप एचटीएमएल के बारे में कुछ भी नहीं पता है और किसी और आप के लिए एक एचटीएमएल टेम्पलेट क्या करना चाहते हैं ? –
आप मेरे दोस्त को गलत कर रहे हैं, यह सीएसएस है :) अगली बार अधिक दोस्ताना होने का प्रयास करें, इससे आपको कोई भी बाधा नहीं है। – Stybos