如果其中一个 DIV 中有一个 100% 宽度 + 非零边距的表格,IE 7 和 IE 8 不会在同一行上呈现 2 个带有 float:left 的后续 div:
<html>
<head>
<title>IE float left bug</title>
<style type="text/css">
.inttable
{
width: 100%;
margin: 9px;
}
.multicolumn
{
margin: 0px;
border: 0px;
padding: 0px;
width:100%;
}
.column
{
margin: 0px;
border: 0px;
padding: 0px;
float:left;
display: inline;
}
</style>
</head>
<body>
<div class="multicolumn">
<div class="column" style="width:50%;">
<table class="inttable">
<tr>
<td>table1</td>
</tr>
</table>
</div>
<div class="column" style="width:50%;">
column 2
</div>
</div>
</body>
</html>
在FireFox、Opera、Chrome和Safari中没有这个问题。
有人知道这个 IE 错误的解决方法吗?
最佳答案
正如 scunliffe 在他的评论中提到的那样,使这个 html 过渡或严格的 xhtml 解决了这个问题。
关于css - IE 7 和 IE 8 不使用 float :left on the same line if there is a table in one of the DIVs 渲染 2 个后续 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1140273/