这是一个令人尴尬的基本问题,但我一直在绞尽脑汁试图找到解决方案,最后挫败感对我来说太多了......
我要做的就是在 IE7 中将网站居中。它在 Firefox、Safari、IE8 和 Chrome 中运行良好。只是不是IE7:
#container
{
margin:0 auto;
width:1035px;
}
我只是看不出这怎么会出错。我已经尝试过严格和过渡的文档类型,我还将正文放在 text-align:center 中(没有区别)。
我们将不胜感激地收到有关此问题的任何建议。
好的,这是(一些)周围的代码:
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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="css/styles.css" media="screen" />
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="css/ie6.css" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="css/ie7.css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="css/ie8.css" />
<![endif]-->
</head>
<body>
<div id="container">
<div id="content-container">
<div id="content">
/* content */
</div>
</div>
</div>
</body>
</html>
CSS(主要):
html,body
{
text-align: center;
background-color:#F8F5EF;
height:100%;
margin:0;
padding:0;
width:100%;
}
#container
{
margin: 0 auto;
width:1100px;
}
#content-container
{
float: left;
width: 1100px;
background-image:url('../images/BG1.gif');
background-repeat:no-repeat;
background-position:0px 0px;
}
#content
{
float: left;
width: 778px;
padding: 15px 0px 80px 15px;
margin: 0 0 60 0px;
}
IE7.css 文件不会修改这些项目。
谢谢!
G