日期:2014-05-16  浏览次数:20818 次

新手,请教一个问题,谢谢!
我在一个div_main中嵌套了三个层,请问怎么才能达到并排排列的效果,第二,三个层我用了绝对定位还是不行,而且感觉中间和右边的层不在main曾里面,请指教,谢谢!
代码:
body {
padding:0px;
background:url(images/beijing1.jpg) #000 repeat left top;
font-family:'Lucida Grande','Lucida Sans Unicode','宋体','新宋体',arial,verdana,sans-serif;
color: #CF0;
font-size:12px;
line-height:150%; 
}

#header{ 
         
         MARGIN: auto;
         BORDER: 1px #CCCCCC solid;
 background: url(images/header_beijing.jpg)  #CCC no-repeat left top;
 WIDTH: 1000px;
 HEIGHT: 100px;
 text-align:center
 
 }
 
#div_main{
padding:0px;
width:1000px;
background:url(images/div_main_beijing.jpg) #CCC no-repeat left top;
margin:20px auto auto auto;
border: 1px #CCC solid;

}

#div_left_sidebar{
margin:10px auto 10px 10px;
border:0px #00ff00 solid;
background: url(images/side_beijing.jpg)  #CCC no-repeat left top;
background-size:cover;
width: 200px;
height:600px;
background-size:cover;
}

#div_zhongjian_sidebar{
float:right;
left:220px;
top:10px;
margin:10px auto 10px auto;
border:0px #00ff00 solid;
background: url(images/zhongjian_beijing.jpg)  #CCC no-repeat left top;
background-size:cover;
width: 560px;
height:600px;

}

#div_right_sidebar{
float:right;
left:790px;
top:10px;
margin:10px 10px 10px auto;
border:0px #00ff00 solid;
background: url(images/side_beijing.jpg)  #CCC no-repeat left top;
background-size:cover;
width: 200px;
height:600px;


页面代码:
<body>
<div id="header">
<strong>这里是头部标题</strong> 
</div>

<div id="div_main">

  <div id="div_left_sidebar"></div>
  
  <div id="div_zhongjian_sidebar"></div>
  
  <div id="div_right_sidebar"></div>
  
</div>

</body>

------解决方案--------------------

<style>
body {
padding:0px;
background:url(images/beijing1.jpg) #000 repeat left top;
font-family:'Lucida Grande','Lucida Sans Unicode','宋体','新宋体',arial,verdana,sans-serif;
color: #CF0;
font-size:12px;
line-height:150%; 
}

#header{ 
         
         MARGIN: auto;
         BORDER: 1px #CCCCCC solid;
 background: