html - 为什么 margin-top 比它在 IE8 下设置的要大?

标签 html css

链接:http://xanlz.com/test/test.html

CSS:

    .hot-version, .week-down, .total-down, .tag {
        border: 1px solid #D4D4D4;
        height: 286px;
        margin-top: 10px;
        padding: 1px;
}

enter image description here enter image description here

红色部分margin-top在IE8下较大,在firefox、IE7下正常。为什么?如何纠正?

最佳答案

使用 css hacks: IE7及以下可以解析*property: value

.hot-version, .week-down, .total-down, .tag {
        border: 1px solid #D4D4D4;
        height: 286px;
        margin-top: 10px; //for IE8
        *margin-top: //another value for IE7;
        padding: 1px;
}

编辑: 这两个链接提供了更多针对 IE6/7/8 的 hack:
http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/
http://www.webdevout.net/css-hacks#in_css

关于html - 为什么 margin-top 比它在 IE8 下设置的要大?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6924631/

相关文章:

html - safari 中未显示输入文本类型

html - 多个 bootstrap css 按钮,隐藏和展开

javascript - 单击按钮时不显示引导加载图标

javascript - 如何将插槽子项附加到 HTML 正文标记以进行绝对定位?

javascript - 如何将 'rowspan' 特定的 CSS 放入 html 表中?

html - 为什么谷歌字体不能与 bootstrap 一起使用?

html - 如何让我的下拉菜单项与导航栏父项的大小相同?

html - 防止带有Style元素的html电子邮件影响整个网页

css - 如何使 Css 顺应图像

css - 尝试在 React 'cards' 周围设置 css 支架的高度