【发布时间】:2015-01-13 15:02:15
【问题描述】:
我有一个 div,它用样式 display: table 包装了一个表格。表格包含高度为 500px http://jsfiddle.net/9ucm7z9h/:
的 div<div style="width: 400px; display: table; background-color: blue;">
<div style="height: 100px; background-color: green; overflow: scroll">
<table style="width: 100%;">
<tr>
<td>
<div id="test" style="height: 500px; background-color: yellow;"> </div>
</td>
</tr>
</table>
</div>
</div>
此代码在 IE 和 Chrome/Firefox 中呈现不同。这是 Chrome/Firefox 的错误吗?我该怎么做才能强制它像在 IE 中一样呈现?
【问题讨论】:
-
你想做什么?我敢肯定有比您当前的标记更容易到达那里的方法。
-
你想让黄色 div 的溢出可见而不是滚动吗?还是您希望蓝色 div 高 100 像素?
-
@TylerH 我希望蓝色 div 的高度为 100 像素,如本例所示:link 但我只能使用 overflow:scroll 更改 div 的样式,或添加一些包装 div。我无法在我的任务中更改根 div 和表。
标签: javascript html css google-chrome firefox