我知道IE7不支持任何CSS属性值inherit
除了direction
和visibility
。当浏览器不支持某个值时,它应该不会应用给定的声明(该特定行)。有谁知道为什么IE7不使用第一个ul a
颜色声明,而是选择使用纯色a
颜色声明?它只是忽略了整个ul a
规则?IE7和“继承”:忽略整个规则?
需要明确的是:在大多数浏览器的第一个链接是红色,第二个链接是蓝色的。在IE7中,第一个链接是红色的,但第二个链接是红色的,即使我至少有一个声明,它应该在ul a
规则中理解。
<!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>
它并不忽视整个规则;如果你放置其他声明,他们仍然会工作。 – BoltClock 2010-11-10 20:26:57
那为什么不用'ul a {color:#369}'? – theazureshadow 2010-11-10 20:29:32
我认为它是用'inherit'值重写它的。不知道为什么这只会影响颜色,但如果我放置一个有效的'padding'和一个无效的'padding'我看不到这种行为。 – BoltClock 2010-11-10 20:30:14