代码之家  ›  专栏  ›  技术社区  ›  theazureshadow

IE7和“继承”:忽略整个规则?

  •  4
  • theazureshadow  · 技术社区  · 14 年前

    inherit 对于除 direction visibility ul a 颜色声明,而不是选择使用普通 a 颜色声明?只是忽略了整个 乌拉

    要清楚:在大多数浏览器中,第一个链接是红色的,第二个链接是蓝色的。在IE7中,第一个链接是红色的,但第二个链接也是红色的,即使我至少有一个声明,它应该在 规则。

    <!DOCTYPE html>
    <html>
    <head>
        <title>Anchor Inherit Test</title>
        <style type="text/css">
        body {
            color: #369;
        }
        a {
            color: #f00;
        }
        ul a {
            color: #369;
            color: inherit; /* this should be ignored by IE7, right? */
        }
        </style>
    </head>
    <body>
        <p>This is testing a <a href="#">red link</a> in a paragraph.</p>
    
        <ul>
            <li><a href="#">here is a link that should not be red</a></li>
        </ul>
    </body>
    </html>
    
    1 回复  |  直到 11 年前
        1
  •  5
  •   Community CDub    8 年前

    color 不是唯一不忽略不支持和无效值的属性。
    例如 background-color display 也会受到影响。

    第一份颜色声明, 而是选择使用普通的 整个ul a规则?

    任何无法识别的值(甚至没有)都会触发错误。
    同样的规则 !important 如果最后一个包含错误值。
    还有这个 jsbin 确认它也有效地重写同一规则中以前的声明。

    dynamic property .