The other browsers are right; IE6 is wrong.
The selector a
should match any <a>
elements, while a:link
only matches <a>
elements that are unvisited hyperlinks (the HTML 4 document type defines hyperlinks as <a>
elements with a href
attribute). Nowhere does it state in either specification that a
should automatically translate to a:link
or vice versa.
Since there's no such translation going on, your two CSS rules have equally specific selectors (your class selector shares equal specificity with each of your pseudo-classes). So, your second rule is supposed to override the first rule for any <a>
elements within div.myclass
, regardless of their link state, thereby making it always red and with no text decoration.
By the way, IE7 also fails to apply the font-weight: bold
style when you test with an <a>
element in div.myclass
that isn't a link, even though it's supposed to as there is no overriding font-weight
style in your second rule:
<div class="myclass">
<p>This is a <a href="2">test</a></p>
<p>This is a <a>test</a></p> <!-- does not bold on hover in IE7! -->
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…