【问题标题】:IE6 double padding and margin bugIE6双填充和边距错误
【发布时间】:2012-04-23 20:29:02
【问题描述】:

我在网上四处寻找,但没有任何效果。

我有一个带有无序列表的盒子,而 ie6 使填充和边距加倍

.block {
    width: 236px;
    float: left;
    border: 1px solid #cecece;
    background: url(images/list_bg.png) repeat-y;

}

.block li {
        width: 237px;
        height: 74px;
        background: url(images/arrow.png) no-repeat 0px 13px, url(images/bottom.png) left bottom no-repeat;
        margin-left: 30px;
        padding: 0px 20px;
        list-style: none;
        line-height: 36px;

    } 

如果我添加显示内联它会中断,我做错了什么?

【问题讨论】:

  • 我为你感到难过。 2011 年还在调试 IE6。
  • 您的代码是否具有有效的文档类型作为第一行,例如<!DOCTYPE html>?如果不是,那是什么?
  • 老实说,我认为答案应该是:不要使用 IE6。
  • 我同意@Dave 和@edwin 的观点——IE6 在过去12 个月中几乎失去了所有剩余的市场份额。几乎没有人再使用它了。支持它真的没有任何意义。如果客户/老板确实坚持支持 IE6,请告诉他们这会使开发和维护网站的成本增加一倍;看看他们是否还想支持它。

标签: css internet-explorer internet-explorer-6


【解决方案1】:

你的盒子比里面的列表项窄。

你应该看看Box Model

【讨论】:

  • 请注意,这仅适用于 IE 处于 Quirks 模式的情况。从您发布的链接:"Internet Explorer 6 and newer are not affected in their standards-compliant mode, but for compatibility reasons, the bug is still present when a page is rendered in "quirks mode"."。我已经问过 OP 他是否有有效的文档类型,所以我们将能够看看这是否是原因。
  • @thirtydot:是的,关于怪癖模式错误,你当然是对的。老实说,我链接到维基百科页面只是为了让 OP 对盒子模型有更深入的了解。然而,父容器的宽度仍然比它的子容器小 1 像素……对我来说,盒子的宽度应该是 307 像素。
  • +1,width 是对的。我没有看到 OP 的“有效”评论。
【解决方案2】:

有时 ie6 会占用双倍边距, 阅读http://www.positioniseverything.net/explorer/doubled-margin.html

我们可以用 ie hack 代码来解决这个问题 ie6 _ , 即 >

.class {_margin-left: 30px;}

.class {>margin-left: 30px;}

【讨论】:

    猜你喜欢
    • 2013-04-23
    • 2010-10-23
    • 2013-05-27
    • 1970-01-01
    • 2014-03-24
    • 1970-01-01
    • 1970-01-01
    • 2011-04-17
    • 2013-05-15
    相关资源
    最近更新 更多