ورود

View Full Version : سوال: ایجاد چند div به صورت افقی کنار هم (مهم لطفا کمکم کنید)



refugee
چهارشنبه 20 اردیبهشت 1391, 15:28 عصر
سلام دوستان ؛
میخواهم مثل این عکسه چند تا دیو تو در تو (کادر) را کنار هم به صورت افقی قرار بدم.

مثل منو های li که کنار هم هستند .
چطور دیو ها را اینجوری کنم ؟‌
نمیخواهم با margin va position این کار را انجام بدم .


لطفا کمکم کنید . ممنونم

refugee
چهارشنبه 20 اردیبهشت 1391, 15:30 عصر
http://up.bakhtarweb.com/images/z3fog86gslixb220mj4v.jpg

Saber Mogaddas
چهارشنبه 20 اردیبهشت 1391, 16:33 عصر
سلام
به این صورت کد هاتون رو تنظیم کنید..


<html>
<head>
<title></title>
<style type="text/css">
#Wraper
{
width:850px;
height:200px;
margin:auto;
}
.box
{
width:200px;
height:200px;
float:right;
background-color:#0b385f;
margin-left:10px;
}
</style>
</head>
<body>
<div id="Wraper">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</body>
</html>

بین باکس ها فاصله هست و استانداردش اینه که از margin استفاده کنید..
نه اگه میگید که باید margin استفاده نشه از div تو در تو به صورت زیر استفاده کنید..


<html>
<head>
<title></title>
<style type="text/css">
#Wraper
{
width:850px;
height:200px;
margin:auto;
}
.box
{
width:200px;
height:200px;
float:right;
background-color:#0b385f;
}
.box-Wrapers
{
float: right;
height: 200px;
width: 212px;
}
</style>
</head>
<body>
<div id="Wraper">
<div class="box-Wrapers">
<div class="box"></div>
</div>
<div class="box-Wrapers">
<div class="box"></div>
</div>
<div class="box-Wrapers">
<div class="box"></div>
</div>
<div class="box-Wrapers">
<div class="box"></div>
</div>
</div>
</body>
</html>

موفق باشی..