PDA

View Full Version : سوال: اشکال این کد چیه؟؟



r4hgozar
چهارشنبه 14 فروردین 1392, 21:28 عصر
سلام دوستان.
اشکال این کد چیه که لوگو من تو وسط صفحه قرار نمی گیره؟!!
هر کاری می کنم لوگو تو وسط صفحه قرار نمی گیره!!
* { margin: 0;
padding: 0;
}
body {
background-color: #fff;
font-size: 12px;
font-family: tahoma;
}
#Hd-bg {
background-image: url('image/header.png');
min-height: 700px;
background-repeat: repeat-x;
}
#wapper {
width: 1000px;
margin: auto;
min-height: 130px;
overflow: hidden;
}
#header-waper {
width: 1000px;
height: 180px;
float: right;
}
#Header-logo {
width: 240;
height: 84px;
margin: 16px auto auto;
}
#header-logo1 {
background-image: url('image/logo1.png');
background-repeat: no-repeat;
width: 160px;
height: 40px;
float: right;
margin-top: 15px;
}


اینم از کد html ام

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title> my site </title>
</head>
<body>
<div id="Hd-bg">
<div id="wapper">
<div id="header-waper">
<div id="Header-logo">
<div id="header-logo1"></div>
</div>
</div>
</div>
</div>
</body>
</html>

mehbod.rayaneh
چهارشنبه 14 فروردین 1392, 22:07 عصر
سلام

* { margin: 0;
padding: 0;
}
body {
background-color: #fff;
font-size: 12px;
font-family: tahoma;
}
#Hd-bg {
background-image: url('image/header.png');
min-height: 700px;
background-repeat: repeat-x;
}
#wapper {
width: 1000px;
margin: auto;
min-height: 130px;
overflow: hidden;
}
#header-waper {
width: 1000px;
height: 180px;
float: right;
}
#Header-logo {
width: 240;
height: 84px;
margin: 16px auto auto auto;
}
#header-logo1 {
background-image: url('image/logo1.png');
background-repeat: no-repeat;
width: 160px;
height: 40px;
margin:15px auto auto auto;
}

r4hgozar
پنج شنبه 15 فروردین 1392, 10:51 صبح
ممنون دوست عزیز.
اما اگه اشتباهم رو یه توضیح می دادین خیلی بهتر می شد.

esmaeilbf
پنج شنبه 15 فروردین 1392, 11:00 صبح
اشتباهت این بود که باید با استفاده از margin : auto عنصر مورد نظر رو وسط قرار میدادی

r4hgozar
پنج شنبه 15 فروردین 1392, 11:16 صبح
اشتباهت این بود که باید با استفاده از margin : auto عنصر مورد نظر رو وسط قرار میدادی


تو کدوم بخش دوست عزیز؟؟ من که margin رو auto قرار دارم؟!!

mehbod.rayaneh
پنج شنبه 15 فروردین 1392, 11:33 صبح
خودتون مقایسه میکردید دیگه!
float:right ک داده بودید و margin:auto ک نداده بودید مشکل کارتون بود!