我的问题只是以div为中心.
目前,我只有一个简单的html文件.我不知道为什么margin: 0 auto不工作.
这是我的html的布局:
<style type="text/css">
#header {
width: 100%;
margin: 0 auto 20px auto;
height: 50px;
background-color: #0F6;
}
#navigation {
width: auto;
float: right;
margin: 0 auto;
display: inline-block;
}
#content {
background-color: #936;
margin: 0 auto;
width: 960px;
position: relative;
min-width: 720px;
max-width: 960px;
}
footer {
background-color:#0F6;
width: 100%;
height: 200px;
}
body {
background-image: url(images/dark_wall.png);
}
</style>
</head>
<body>
<div id="header">
<div id="navigation">This is the nav</div>
</div>
<div id="content">
<div id="content_top">
</div> …Run Code Online (Sandbox Code Playgroud) margin ×1