width为什么在IE里不起作用呢?
我明明
body { margin:0px auto;
border:1px solid red;
width: 780px;
}
这里写了width:780px;
而且margin:0px auto;
来让body宽度为780px了而且定义为居中,但为什么在IE里看BODY,还是满屏,而且不是居中呢。???
++++++++++++
<html>
<head>
<style type= "text/css ">
<!--
* { margin:0;padding:0}
body { margin:0px auto;
border:1px solid red;
width: 780px;
}
div {border:1px dashed blue;}
#header {
width:780px;
height:90px;
}
#nav {
height: 25px;
width: 780px;
font-size: 14px;
list-style-type: none;
}
#nav li {
float:left;
}
#nav li a{
color:#000000;
text-decoration:none;
padding-top:4px;
display:block;
width:197px;
height:21px;
text-align:center;
background-color: #009966;
margin-left:2px;
}
#nav li a:hover{
background-color:#006633;
color:#FFFFFF;
}
#content {width:780px;}
#content p {text-indent:5em;font-size:14px;}
#content h2 {text-indent:1em;}
#footer {
width:780px;
color:#ccc;
background-color:#000;
height:45px;
text-align:center;
padding-top:2px;
}
-->
</style>
</head>
<body>
<div id= "header "> <img src= "1.png " alt= "1 "> </div>
<ul id= "nav ">
<li> <a href= "# "> 首页 </a> </li> <li> <a href= "# "> 资料 </a> </li> <li> <a href= "# "> 电影 </a> </li>
</ul>
<div id= "content "> <h2> 目录 </h2> <p> 11 </p> </div>
<div id= "footer "> <p> love | sad | dark | dream </p> <p> copyright@ning 2007 </p> </div>
</body>
</html>
[解决办法]
..you can 's set your body 's width,
you can only use padding to move the content 's location.
[解决办法]
没有加上
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
[解决办法]
jobnsonijl是对的.
body可以定义宽度.
声明一定要加,不然css会无效....
[解决办法]
原来BODY也可以设置WIDTH....
习惯DIV了 呵呵