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?
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>
开发者_StackOverflow <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
isn't the only property which doesn't ignore unsupported and invalid values.
For example background-color
and display
are affected too.
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?
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.
As an alternative you could use a dynamic property.
精彩评论