css - 最后一行列表项在 IE7 上缺少底部边距

标签 css internet-explorer internet-explorer-7

我想知道为什么在 IE7 上作为最后一行列出的元素缺少底部边距?

http://jsfiddle.net/JeaffreyGilbert/sW5DB/ enter image description here

最佳答案

仍然有(恼人的)方法可以使用 float 来修复它,但在这种情况下最简单的解决方案是切换到 display: inline-block

参见: http://jsfiddle.net/3rjdf/

用三个新属性替换 float:left:

ul { width:300px; margin:0; padding:0; overflow:hidden; list-style:none; background:#ccc; }
li { display:inline-block; *display:inline; zoom:1; /* float:left; */ width:98px; height:120px; margin-bottom:30px; border:1px solid black; background:#f0f0f0; }

*display:inline; zoom:1; is explained here.可以说它使它可以在 IE7 中运行。

我还必须折叠您的 HTML 中的空格(为什么?请阅读 12):

<ul>
    <li></li><li></li><li></li><li></li><li></li>
</ul>

关于css - 最后一行列表项在 IE7 上缺少底部边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5934762/

相关文章:

javascript - 悬停在 10px 距离内

css - 在 Angular4 的 CSS 中使用主机直接子节点

javascript - 当获取 30MB 或更多数据时,Internet Explorer 将 undefined 传递给成功回调

internet-explorer - 无法在 IE 中播放 vlc 插件中的视频

css - IE7、IE8 子选择器问题

html - 如何显示父级的底部边框而不是子级的顶部边框?

css - Tailwind CSS 更改占位符选项的文本颜色

html - header 在 IE 7-8 中乱七八糟

javascript - IE7 不调用 javascript onclick

html - 在 IE7 中正确对齐一行上的两个 div