IE7和“inherit”:忽略整个规则? [英] IE7 and "inherit": ignoring entire rule?

查看:215
本文介绍了IE7和“inherit”:忽略整个规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道IE7不支持除 direction 和<$ c>之外的任何CSS属性的值 inherit $ c> visibility 。当浏览器不支持一个值,它应该简单地不应用给定的声明(该特定行)。有没有人知道为什么IE7不使用第一个 ul a 颜色声明,而是选择使用简单的 a 颜色宣言?是否只是忽略整个 ul a 规则?

I know that IE7 doesn't support the value inherit for any CSS properties except direction and visibility. When a browser doesn't support a value, it should simply not apply the given declaration (that particular line). Does anyone know why IE7 doesn't use the first ul a color declaration, instead choosing to use the plain a color declaration? Is it just ignoring the entire ul a rule?

要清楚:在大多数浏览器中,并且第二链路是蓝色的。在IE7中,第一个链接是红色的,第二个链接是第二个,尽管我在 ul a 规则中应该理解至少一个声明。

To be clear: in most browsers the first link is red and the second link is blue. In IE7 the first link is red, but so is the second, even though I have at least one declaration it should understand in the ul a rule.

<!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>


推荐答案

color 不是不忽略不支持和无效值的唯一属性。

例如 background-color display 也会受到影响。

color isn't the only property which doesn't ignore unsupported and invalid values.
For example background-color and display are affected too.


有没有人知道为什么IE7不使用
ul的颜色声明,
而不是选择使用plain a
颜色声明?是否只是忽略
整个规则?

Does anyone know why IE7 doesn't use the first ul a color declaration, instead choosing to use the plain a color declaration? Is it just ignoring the entire ul a rule?

任何无法识别的值(甚至没有)都会触发错误。 br>
显然,如果最后一个包含一个规则,LTE IE7会丢弃同一个规则中的所有颜色声明(!important 错误的值。

jsbin 确认它有效地覆盖了同一规则中的以前的声明

Any unrecognized value (even none) will trigger the bug.
Apparently LTE IE7 discards all the color declarations in the same rule (even !important ones) if the last one contains an erroneous value.
And this jsbin confirms that it effectively overrides previous declarations in the same rule too.

您也可以使用动态属性

这篇关于IE7和“inherit”:忽略整个规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆