CSS anchor colors do not seem to be affected the link

I had this question after viewing The Menu is good, but needs a couple of Tweaks.

I added these two CSS rules:

.sub-menu-item > a:hover {
      color:red;
}

.sub-menu-item > a:link {
      color:black;
}

The color of the link does indeed show the text black,  but on hovering,  the color of the text doesn't change to red.
LVL 1
Howard BashSenior Software EngineerAsked:
Who is Participating?
 
Jason CarsonFreelance Computer TechnicianCommented:
You can try this...
.sub-menu-item > a:hover {
      color:red !important;
}

Open in new window

The !important means it will override any style that has precedence and use this rule instead, but it would help to have a link to the website so we can see all the code.
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
You may have a more specific style that is taking precedence. Can you post a link to the live page?
0
 
Howard BashSenior Software EngineerAuthor Commented:
Hi,

I added the !important and it works.  Not sure what is colliding with it.  But that works for me.  Thank you sir.
0
 
Howard BashSenior Software EngineerAuthor Commented:
Worked as required.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.