You’re viewing an archive of outdated material. Visit The Web Standards Project’s updated site to learn about our current mission.

Link Pseudo-classes (2)

MacIE does not parse pseudo-classes correctly. It uses only the last pseudo-class specified, and it treats all the others as if they weren't there. (It doesn't treat multiple pseudo classes as an error, though.) Multiple pseudo classes are necessary to write sensible rules for CSS2 browsers that support the concept of :hover on all elements (not just link elements). Fortunately, this problem can be worked around by using :link:hover, :visited:hover (as opposed to :hover:link, :hover:visited which should work just as well).

This page has the following stylesheet:

:link { color: blue; background: white; }
:visited { color: purple; background: white; }

p.one :hover:link, p.one :hover:visited { background: yellow; }

p.two :link:hover { background: yellow; }
p.two :visited:hover { background: aqua; }

This paragraph has class one. Any link in this paragraph should have a yellow background (instead of white) only when it is in the hover state, which is probably when the mouse pointer hovers over the link. Instead, MacIE gives both visited links and unvisited links yellow backgrounds all the time.

This paragraph has class two. In this paragraph, the background color for visited links in the hover state should be aqua, but the background color for unvisited links in the hover state should be yellow. MacIE makes both of them aqua, since it only uses the last pseudo-class in the selector.