DIV布局的问题,请高手指教谢谢!在线等

来源:百度知道 编辑:UC知道 时间:2024/05/16 08:43:02
<style type="text/css">
body
{ margin-bottom:0px; margin-left:0px; margin-right:0px; margin-top:0px;}
#body1
{ width:100px; height:300px;}
#table1
{ width:200px; background:#000000; height:100px; float:left;}
#table2
{ width:100%; background:#006600; height:100px; float:left;}
</style>
</head>
<body>
<Div id="body1">
<div id="table1"></div>
<div id="table2"></div>
</Div>
body1中嵌套了两个DIV
table2设置100%的话他就下去,怎么才能把table1旁边的都给table2
不用象素的情况下,body1也不能用象素,因为是相对整个窗口的
#body1
{ width:100px; height:300px;}

#body1
{ width:100%; height:300px;}
1楼这样肯定不行啊

我给你写一下,不知道是不是你想要的:
<style type="text/css">
body
{ margin:0;}
#body1
{ width:100px; height:300px;}
#table1
{ width:200px; background:#000000; height:100px; float:left;}
#table2
{ margin-left:200px;width:100%; background:#006600; height:100px; float:left;}
</style>