Announcement

Collapse
No announcement yet.

CSS styling links (a:link, a:visited, a:active, a:hover) not working - only some of them work?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • CSS styling links (a:link, a:visited, a:active, a:hover) not working - only some of them work?

    Hello,

    Sorry if this seems to be a basic question but I have no idea what I am doing wrong here. I am trying to change the default styling for hyperlinks (see my code below) but I can't seem to figure out what the problem is - my CSS code looks fine to me. Bottom line, it seems as if some of the styling works and others don't. Am I doing anything wrong here?

    Any help greatly appreciated.

    Code:
    a:link { color: #000; text-decoration: underline; } a:hover { color: #999; text-decoration: underline overline; } a:visited { color: #000; text-decoration: underline; } a:active { color: #FF0000; text-decoration: underline; }

  • #2
    Re: CSS styling links (a:link, a:visited, a:active, a:hover) not working - only some of them work?

    Hi Reece,

    The reason being is because you have the selectors in an incorrect order. For some technical reason (you can probably find out why if you do an online search about it), you need them in L, V, H, A order (people may refer this as LoVe HAte in order to memorise the order). In your case:

    Code:
    a:link { color: #000; text-decoration: underline; } a:visited { color: #000; text-decoration: underline; } a:hover { color: #999; text-decoration: underline overline; } a:active { color: #FF0000; text-decoration: underline; }
    Regards,

    Ben Stones.

    Comment

    Working...
    X