Dreamweaver中div怎么页面居中?

Dreamweaver中div怎么页面居中?我写的DIV都是靠左,怎么让它页面居中?在html中添加代码还是CSS中?请帮我修改下!
html:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>某某公司</title>
<link href="index.css" rel="stylesheet" type="text/css">
</head>

<body>
<div class="header">
<div class="logo"><img src="images/logo.jpg" width="162" height="149" alt=""/></div>
<div class="nav"> 毛衣 T衫 短袖 长袖</div>
</div>
</body>
</html>

CSS:
@charset "utf-8";
/* CSS Document */
.header{
width:900px;
height:149px;
background-image:url(images/index1.jpg)
}
.logo{
width:162px;
height:149;
float:left
}
.nav{
width:590px;
height:149px;
float:right;
color:#F9F9F9;
font:20px;
font-family:"微软雅黑";
line-height:150px;
text-align:center;
letter-spacing:15px;
}

在.header的样式中加入margin:0px auto;追问

这个在实时试图中为什么不居中?只是在网页中居中?

追答

dw对好多css样式是不认的,css最终的效果是要在页面中显示的,因此dw只是一个对你编写代码有帮助的工具而不是从视图模式下验证错误的软件

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-01-15
.header{
width:900px;
height:149px;
background-image:url(images/index1.jpg);
margin:0 auto;
}追问

这个在实时试图中为什么不居中?只是在网页中居中?

追答

网页居中不就行了吗啊