谁能解释一下为什么 IE7 坚持要在这个例子中的 table 和 ul 之间放置一个空格?它似乎不会发生在 IE8 或 FF 中。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<ul style="background-color: Blue;">
<li>
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color: Red">
<tr>
<td>
<img style="display: block" src="http://www.google.com/intl/en_ALL/images/logo.gif"
height="25" border="0" width="150" />
</td>
</tr>
</table>
<ul style="background-color: Green">
<li>One</li>
<li>Two</li>
</ul>
</li>
</ul>
</body>
</html>
最佳答案
你需要给hasLayout到包含表和 ul 的 li。
<ul style="background-color: Blue;">
<li style="zoom:1;">
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color: Red">
关于css - 一个UL内的IE7间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1374646/