我知道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