pseudo-class grouping order in links

Discussion in 'Web Design and Development' started by design-is, Mar 9, 2009.

  1. design-is macrumors 65816

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.
    #1
    When you group the pseudo-classes (a:link, a:visitied...) does active still need to come below hover?

    Or could you do for example:

    Code:
    a:link, a:visited, a:active {
    	stuff
    }
    
    a:hover {
    	stuff
    }

    I've used it like this before - is there any reason I shouldn't?

    Cheers,

    /Doug
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    I've read from time-to-time about the ordering, but I generally don't think about it when I code it up. I've never seen any negative effects from ordering them differently.
     
  3. design-is thread starter macrumors 65816

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.
    #3
    Pretty much my experience too. Thanks for confirming :cool:
     
  4. savar macrumors 68000

    savar

    Joined:
    Jun 6, 2003
    Location:
    District of Columbia
    #4
    I believe that the order does matter.

    http://www.w3schools.com/CSS/css_pseudo_classes.asp

    Maybe Safari doesn't have this restriction (or is it a requirement?), but it doesn't sound like its safe to abandon it.
     
  5. ChicoWeb macrumors 65816

    ChicoWeb

    Joined:
    Aug 16, 2004
    Location:
    California
    #5
    I've seen some issues when they are not in the correct order before. Typically it seems like an IE 6 problem. It's been a while, but I remember in the day when we used a lot of tables we'd often have a hard time getting the colors to work properly on a, or a:link if it wasn't correct.
     
  6. design-is thread starter macrumors 65816

    design-is

    Joined:
    Oct 17, 2007
    Location:
    London / U.K.
    #6
    Hmm, yeh, actually I think I remember something similar. Nowadays I don't come across any problems, but I guess that's just because I avoid them in other ways. Don't really tend to use active states, so probably why I haven't noticed them breaking.

    Will endeavour to order correctly in future.
     

Share This Page