CSS布局问题
我在写一个页面,结构是:
<div>head</div>
<div>body</div>
--|<div>left</div>
|<div>right</div>
<div>footer</div>
当我设置主体(body)部分的左右(left、right)两个分栏时,出现问题:left与right出现了错位空挡,我本来希望他们左右并列的,但这两列却上下错开,不知道为什么。
下面是我的 CSS 代码,请各位高手大哥帮忙看看问题在哪里?
谢谢:)
css样式部分:
<style type="text/css">
<!--
#header {
padding: 0px;
width: 80%;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
position: relative;
height: auto;
left:10%;
right:10%;
top: 1%;
bottom: 25%;
}
#center {
padding: 0px;
margin:0;
width: 80%;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
position: relative;
height: auto;
left:10%;
right:10%;
top:25%;
bottom: 78%;
}
#footer {
padding: 0px;
width: 80%;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
position: relative;
height: auto;
left:10%;
right:10%;
top:78%;
bottom: 100%;
}
#left{
background-color:#cccccc;
width:50%;
height:auto;
position: relative;
top:0%;
left: 0%;
right: 50%;
bottom: 100%;
margin: 0px;
}
#right{
background-color:#cccccc;
width:50%;
height:auto;
position: relative;
top:0%;
left: 50%;
right: 0%;
bottom: 100%;
margin: 0px;
}
-->
</style>
网页主体部分:
<body>
<!-- 头部 -->
<div id="header">
<div>页头</div>
<div>导航</div>
<div>广告</div>
</div>
<!-- 网页中间部分,包括左、右两个分栏 -->
<div id="center">
<div id="left">
<div>宗旨</div>
<div>最新动态</div>
<div>客服</div>
</div>
<div id="right">
<div>服务范围</div>
<div>下载</div>
<div>产品区</div>
</div>
</div>
<!-- 页尾 -->
<div id="footer">footer
<div></div>
</div>
</body>