小弟初学,望高手们指点下:
一个页面,我使用div+css 布局,div嵌套的方式,但后来嵌套进来的东东会居中显示,有点闷了...
css内容:
/*基本信息*/
body{
text-align:center;
margin:auto;
background:url("../Public/img/bg.jpg") repeat;
}
/*页面层容器*/
#container{
width:1024px;
height:768px;
margin:auto;
background:red;
}
/*页面头部_banner*/
#banner{
width:1024px;
height:172px;
background:url("../Public/img/logo.jpg") no-repeat;
}
/*页面头部_导航*/
#nav{
width:1024px;
height:40px;
font:bold;
color:#ffffff;
background:url("../Public/img/nav_bg.jpg") repeat;
margin:auto;
overflow:hidden;
}
/*左侧部分*/
#nav_left{
width:200px;
height:556px;
background:green;
text-align:left;
}
/*主要内容(中间部分)*/
#content{
width:700px;
height:556px;
background:yellow;
}
页面内容:
<body>
<div id="container">
<div id="banner">
</div>
<div id="nav">
...
....
</div>
<div id="nav_left">
</div>
<div id="content">
</div>
</div>
</body>
页面显示是这样的
