I believe it's because a:hover
is more specific than a:link
.
If the original a:hover
font-size was unspecified, it would be inherited from a:link
. But since there is an a:hover
specification, a.myclass:hover
rather takes this value than the more "general" a.myclass:link
.
I read somewhere to think of the a
pseudo-classes as "love hate": :link
, :visited
, :hover
, :active
, one more specific than the previous. If you define something for a
or :link
, it should be inherited by all the following pseudo-classes. That value can be overridden though, and the specificity of the pseudo-class is more important than the order in which the styles are defined or what other "real" classes are attached to the link.
The reason it works differently in IE6 is that IE6 does it wrong, which shouldn't come as a surprise.
Differences in parsing (possibly backwards):
a:hover { font-size: 8pt }
a.myclass:link { font-size: 14px }
a.myclass:hover { }
How it should be:
Every :hover
, regardless of .class
, is 8pt.
How IE6 understands it:
:hover
is not in the same class as .myclass:hover
. Since there's no size specified for .myclass:hover
, let's inherit from the next higher available pseudo-class in the same class, which is .myclass:link
. That makes .myclass:hover
14px.
Estimated lookup priorities:
Others IE6
a a
a.class a:link
a:link a:hover
a.class:link a.class
a:hover a.class:link
a.class:hover a.class:hover <-- Lookup starts here, goes up.