/    Sign up×
Community /Pin to ProfileBookmark

a:hover not working

I stripped my files to a few lines to reduce the number of possible sources of the problem. I have a small html file with one link to another page and my html file uses a css file with the three declarations below:

a:link {
color: #0000FF;
text-decoration: none;
}

a:hover {
color: #FF0000;
text-decoration: underline;
}

a:visited { color: #993366;
text-decoration: none;
}

If I comment out the “visited” rule, then hover works, but with a:visited there, hover does not cahange the color or put the underline on the link’s text.
I am using IE6.0
Any ideas as to why this may be happening?
I’ll appreciate your help.

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@fredmvFeb 26.2004 — Your CSS for your links should be in the order of: [list=1]
  • [*][font=courier]:link[/font]
  • [*][font=courier]:visited[/font]
  • [*][font=courier]:hover[/font]
  • [*][font=courier]:active[/font]
  • [/list]
    Most people remember it like this: LoVe HAte.
    Copy linkTweet thisAlerts:
    @TimeBanditFeb 26.2004 — fredmv has it right. You should also know that some browsers inherit these improperly so you should be verbose in the hierarchy of your CSS declaration if you nest any <a> links.

    In a page that has several groups of navigation, header, side, footer, etc., be verbose with the parent-child naming of the style. I don't have an exact sample handy but a co-wroker here just ran into it a couple weeks ago and being verbose solved it.

    By verbose I mean to be more specific than you'd think you need to be, like:

    #div1 #nested-div1 ul li.lvl1 a:link {yadda}

    #div1 #nested-div1 ul li.lvl1 a:visited {yadda}

    #div1 #nested-div1 ul li.lvl1 a:hover {yadda}

    #div1 #nested-div1 ul li.lvl1 a:active {yadda}

    Although this causes some excessive code it has solved "misbehaving" link issues for me several times.
    Copy linkTweet thisAlerts:
    @quantumauthorFeb 27.2004 — Thanks for your advice Fred and TimeBandit. My code is now working after changin the order of the rules as you suggested.

    Thanks Again,

    -Quantum-
    ×

    Success!

    Help @quantum spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.2,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,
    )...