【发布时间】:2011-01-26 02:29:23
【问题描述】:
这是我的代码,简化为相关部分:
<html><head><title></title>
<style type="text/css">
body { background-color: #fff; }
#titlebar{ border: solid 1px black; margin:10px; }
#bodyWrapper{ float: left; width: 100%; }
#bodyColumn{ margin-left: 230px; height:500px; }
#menuColumn{
float: left;
width: 230px;
border: solid 1px black;
margin-left: -100%;
height:500px;
}
.bigContent{ width: 100%; margin:10px; }
.section{
border: 1px solid black;
padding:10px;
overflow: auto;
}
</style></head><body>
<div id="titlebar">Title</div>
<div id="bodyWrapper"><div id="bodyColumn">
<table class="section bigContent"><tr><td>FIRST</td></table></table>
<div class="section bigContent">SECOND</div>
</div></div>
<div id="menuColumn">MENU</div>
</body></html>
我的问题:
- 包含“SECOND”的
<div>比包含“FIRST”的<table>宽,尽管它们是兄弟姐妹并且通过相同的 CSS 类具有width=100% -
<div>也比屏幕宽,导致出现滚动条
为什么会这样,我可以做些什么来解决它?
注意:我在 Firefox 3.6 和 IE 8 中都看到了同样的问题
【问题讨论】: