General HTML Links Style question. RRS feed

  • Question

  • In the reference here:

    It says...

    When setting the style for several link states, there are some order rules:

    • a:hover MUST come after a:link and a:visited
    • a:active MUST come after a:hover

    Why is there an order requirement?

    Tuesday, November 16, 2010 6:13 PM


All replies

  • Although this has nothing to do with Silverlight, I have been wondering that thing also and tried to search for an answer but didn't find anything else than just the fact that it doesn't work consistently if in any other order. Must be some browser rendering thing because wrong order still works in some browsers but not in others. Also found a memory rule for you:

    Link - Visited - Hover - Active 

    Wednesday, November 17, 2010 1:16 AM
  • Hi. That requirement comes from the way the cascading rules apply those properties. A link can be both hovered and active, or even have three states (e.g. visited, hovered and active), hence the order is important to pick the correct property value that should be currently used. I think most browsers don't really care about the order, but the CSS specs require it to be correct:

    Note that the A:hover must be placed after the A:link and A:visited rules, since otherwise the cascading rules will hide the 'color' property of the A:hover rule. Similarly, because A:active is placed after A:hover, the active color (lime) will apply when the user both activates and hovers over the A element.

    Wednesday, November 17, 2010 1:30 AM
  • Hi,

    In the reference here:

    But this is Silverlight Forum, So, I suggest you can also forward your question to relevant forum for some helps.





    Thursday, November 18, 2010 4:25 AM