css - 一个UL内的IE7间距

标签 css internet-explorer internet-explorer-7

谁能解释一下为什么 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/

相关文章:

html - CSS - 将图像保留在桌面框架图像中的响应式设计

html - 在较大的 div 中垂直移动 div

javascript - 如何知道 Internet Explorer(IE) 中的 cookie 过期时间

javascript - JQuery UI 日期选择器 "dialog"在 IE8 中不起作用

css - 如何让这个文本在 IE7 中围绕 float 正确流动

python - 根据首字母修改字符串内容

html - 子高度为可滚动父内容高度的 100%

html - 列表背景颜色在 IE7 中搞砸了

html - IE7 中的额外空间,div 中有一个表

CSS IE7 如何强制 LI 内的 UL 比父级宽